-
-
Notifications
You must be signed in to change notification settings - Fork 0
Registering block templates #346
Copy link
Copy link
Labels
area:contentAnything that needs copy-editing assistanceAnything that needs copy-editing assistancestatus:in-progressWork actively underwayWork actively underwaystatus:needs-devEarly execution signal (triage queue for engineering)Early execution signal (triage queue for engineering)
Milestone
Description
Description
We need to register three custom post types in the Tour Operator plugin: Tours, Accommodation, and Destinations. These post types will manage content related to the tours offered, accommodations available, and destinations covered within the plugin.
Requirements
- All templates should be registered using the
register_block_template()function, ensuring compatibility with the block editor. - Templates should follow WordPress standards and include placeholders for dynamic content (e.g., title, content, featured image).
- Patterns should be registered using
register_block_pattern()with appropriate categories (e.g., tours, accommodation, destinations). - Patterns should feature pre-defined blocks to create structured layouts for tour, accommodation, and destination information.
- Template should be grouped by the author (the plugin name)
Templates to Register:
Single Templates:
- single-tour
- single-accommodation
- single-country
- single-region
Archive Templates:
- tour-archive
- accommodation-archive
- destination-archive
Term Archives
- Continent - Term Archive
- Travel Style - Term Archive
- Type - Term Archive
- Brand - Term Archive
Search Results
- Archive - No search Filters
- Archive - With Search filters
References:
- [Tutorial on Registering block templates via plugins in WordPress 6.7] (https://developer.wordpress.org/news/2024/08/29/registering-block-templates-via-plugins-in-wordpress-6-7/)
- Add plugin template registration API #61577
- Adding custom templates
- You can register custom templates via the
customTemplatesproperty in theme.json. It accepts an array of template objects, each defining an individual template. - Each object passed to the
customTemplatesarray supports these properties:name: The name of your template file without the file extension.title: A human-readable title for your template, which may be translated.postTypes: An array of post type slugs that the template is usable on. This is an optional setting and defaults to thepagepost type.
- For block themes, WordPress will look for custom templates (all templates, actually) in the theme’s
/templatesfolder. Therefore, if you register a template with the name of example, you must also have an/templates/example.htmlfile in your theme. - You can add as many custom templates as you want to your theme. Just keep in mind the usability aspect of offering too many choices.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:contentAnything that needs copy-editing assistanceAnything that needs copy-editing assistancestatus:in-progressWork actively underwayWork actively underwaystatus:needs-devEarly execution signal (triage queue for engineering)Early execution signal (triage queue for engineering)
Type
Projects
Status
🏗️ In Progress