Skip to main content

Template Structure

Repository​

- wordpress-template/
├ htdocs/ # WordPress (core, plugins and the theme)
├ .husky/ # Git hooks (converts images to WebP on commit)
├ .nvmrc / mise.toml # Node version
├ CLAUDE.md # Rules for coding agents
├ README.md # How to write the settings files
└ package.json # SCSS build, image conversion and lint

Theme​

All paths in this guide are relative to the theme, htdocs/wp-content/themes/Template/.

- Template/
├ data/ # Assets (SCSS, CSS, JavaScript and images). See the HTML coding rules
├ form/ # Form parts (mail bodies and error messages)
├ include/ # Mechanism. Not changed per project
│ ├ acf.php # Custom field helpers (_get_field() and others)
│ ├ admin.php # Admin screen adjustments (menus hidden from editors)
│ ├ comments.php # Disables comments site-wide
│ ├ fields.php # Registers settings/fields/
│ ├ forms.php # Registers settings/forms/ (TOFU)
│ ├ functions.php # Template functions (loadScript() and others)
│ ├ init.php # Theme supports and image sizes
│ ├ pagenavi.php # WP-PageNavi classes
│ ├ pages.php # Creates the pages in settings/pages.php
│ ├ post-types.php # Registers settings/post-types/ (TOBIUO)
│ ├ query.php # pre_get_posts hook
│ ├ search.php # Disables site search
│ ├ seo.php # Passes settings/seo.php and others to TONKATSU
│ ├ template.php # Common CSS / JS and the page-parent__child.php templates
│ └ webp.php # Writes the WebP rules into .htaccess
├ settings/ # Definitions. Edited per project
│ ├ fields/ # Custom fields (one field group per file)
│ ├ forms/ # Forms (one form per file, _common.php for shared values)
│ ├ post-types/ # Post types and taxonomies (one post type per file)
│ ├ pages.php # Pages
│ ├ redirects.php # Redirects
│ └ seo.php # Site-wide SEO settings
├ templates/ # Reusable template parts
├ 404.php # Not found page
├ archive.php # News archive
├ archive-case.php # Case study archive (sample custom post type)
├ config.php # Version number for the asset URLs
├ footer.php / header.php
├ functions.php # Loads the files in include/
├ home.php # Front page
├ page.php # Pages without a template of their own
├ page-contact.php # Contact form (input, confirm and result)
├ page-contact__confirm.php
├ page-contact__result.php
├ page-sample.php # Sample page and its child page
├ page-sample__child.php
├ single.php # News post
├ single-case.php # Case study post
├ style.css # Theme header only. No need to edit
└ taxonomy-case_category.php # Case study category archive

Files in settings/ whose names start with _ (e.g. settings/forms/_common.php) are skipped when a directory is loaded. Use them for shared values and parts.

Other features​

These work without any settings.

FileWhat it does
include/webp.phpWrites the rules that serve the .webp images into .htaccess. Writes happen in the admin only
include/search.phpRedirects site search (?s=) to the front page with a 301
include/comments.phpDisables comments site-wide
include/admin.phpHides menus such as Pages, Tools and Settings from editors