WordPress Custom Template Generator
Purpose
Generate WordPress block theme custom templates as a paired deliverable:
- a template file in
/templates - a matching
customTemplatesentry intheme.json
This skill is for template needs that sit outside the normal hierarchy flow, such as named editorial layouts, landing-page layouts, or post-type-specific custom templates.
It does not replace the normal hierarchy-aware template generator for index, single, page, archive, or similar standard templates.
Trigger Conditions
Use this skill when the request is about:
- registering a custom template in
theme.json - creating a named custom template for one or more post types
- generating both a custom template file and the required registration entry
- building a special-purpose page or post layout outside the default hierarchy
Do not use this skill for:
- normal hierarchy template generation only
- pattern-only generation
- template-part-only generation
- broad validation-only review
Those belong to the relevant specialist skills.
Inputs
Accept any mix of:
- custom template purpose or title
- desired template name
- target post types
- required template parts
- required pattern slugs
- content requirements
- layout notes
- repository conventions
If the name, title, or postTypes values are incomplete, use wordpress-asset-parameter-generator behavior first and state assumptions.
Fast Decision Flow
- Confirm this is a custom template rather than a normal hierarchy template.
- Normalize:
- template name
- human-readable title
postTypes
- Draft the target file path in
/templates/{name}.html. - Generate the matching
customTemplatesentry fortheme.json. - Generate the template markup.
- Include
core/post-contentwhen editable entry content must render. - Mark anything that should be reviewed by
wordpress-block-asset-validator.
Workflow
- Inspect the request and capture confirmed facts only.
- Choose a stable hyphen-case template name.
- Draft the file path in
/templates. - Generate the
theme.jsoncustomTemplatesentry with:
nametitlepostTypes
- Compose the template with shared parts and patterns where appropriate.
- Add
core/post-contentwhen the template should render editable content. - Return the file path, template file,
theme.jsonfragment, assumptions, and validation notes.
Custom Template Rules
- Custom templates require both the file and the
theme.jsonregistration. - The file lives in
/templates/{name}.html. - The registration belongs under
customTemplatesintheme.json. - Use a stable hyphen-case
name. - Use a readable
title. - Make
postTypesexplicit when known. - Include
core/post-contentwhen editable entry content must render. - Keep reusable page sections in template parts or patterns where possible.
Output Format
By default, return:
- the intended file path
- the complete template file
- the
theme.jsonfragment - assumptions
- validation notes
Example output shape:
## File path
/templates/content-canvas.html
## Template file
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
<!-- wp:main -->
<main>
<!-- wp:post-content /-->
</main>
<!-- /wp:main -->
<!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->
## theme.json fragment
{
"customTemplates": [
{
"name": "content-canvas",
"title": "Content Canvas",
"postTypes": ["page", "post"]
}
]
}
## Assumptions
- The template is intended for both pages and posts.
## Validation notes
- Confirm the post type list and title.
- Run the validator before commit.
Safe Defaults
- choose a readable hyphen-case template name
- make
postTypesexplicit when there is enough evidence - default to
pageonly when the prompt gives no stronger signal - include shared header and footer parts where appropriate
- include
core/post-contentwhen the template is meant to render editable content
Failure Modes And Escalation
Escalate briefly when:
- the request is actually a normal hierarchy template request
- the requested
postTypesdo not match the stated use case - the prompt lacks enough detail to choose a stable custom template name
- the user wants a file without the
theme.jsonregistration or the reverse
In those cases, ask at most one focused question or return a safe scaffold with explicit assumptions.
Test Prompts
Test prompt: editorial custom template
Prompt:
Create a Content Canvas custom template for pages and posts with shared header and footer and editable entry content.
Expected behaviour:
- output
/templates/content-canvas.html - output a matching
customTemplatesfragment - set
postTypestopageandpost - include
core/post-content - recommend validator review
Test prompt: landing-page template
Prompt:
Build a Landing Page custom template for pages only. It should support a hero pattern and a simpler footer.
Expected behaviour:
- generate both the file and the registration fragment
- set
postTypestopage - include the requested reusable assets sensibly
Test prompt: boundary case
Prompt:
Create
single.htmlfor blog posts using the standard hierarchy.
Expected behaviour:
- do not treat this as custom-template work
- route to the normal template generator
- optionally mention that custom templates are for non-hierarchy editorial layouts
References
references/workflow.mdreferences/wordpress-rules.mdreferences/output-templates.mdreferences/qa-rubric.md
_Docs signed by 🤖 Copilot for LightSpeedWP – always fresh!_