You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What?
An optional primary template that rules over all other templates.
When enabled, the primary template would be requested first, and then other templates would be rendered within the primary template.
Why?
A couple of real world examples.
So you want to make the header sticky, fixed to the top of the page. This is done by wrapping the header template part in a group block and setting the position of the group to sticky. To do this site-wide you need to go through every template and wrap the header in a sticky group. If you forget one template or introduce a new custom post type with a new template, you don't have a consistent design across the whole site. At some point you decide to no longer have a sticky header, again this involves editing every template to ungroup every instance of the header template part.
A vertical side header. This can be accomplished by using columns (or a row or grid block perhaps) and then inserting the header template part in the first column (or second column if you want it right aligned), and you probably want to give the first column a defined width of say 300px or 20% for example. The content or query block would then go in the second column. Now you need to repeat this for every template. You then change the default font size or block spacing or you need the menu in the side header to accommodate more items and it becomes apparent that the side header width needs increasing or decreasing, so you need to go through each and every template making sure to give the column wrapper the same width.
If there was an optional primary template, both the scenarios above could be accomplished by adding the group/columns/row/grid layout in the primary template, and then there could be something like a template block which you would add in the remaining page space. This template block would then render the appropriate template, be it single, page, index, search results, 404, custom_post_type, custom_archive etc. The individual templates wouldn't need to contain the header, or the complex site wide layout, instead they would be freed up to concentrate on just what that template is needed for e.g. post content, query loop etc. There could even be an option at the template level to opt out of the primary template hierarchy if you wanted a particular template to break away from the site wide layout.
The text was updated successfully, but these errors were encountered:
What?
An optional primary template that rules over all other templates.
When enabled, the primary template would be requested first, and then other templates would be rendered within the primary template.
Why?
A couple of real world examples.
So you want to make the header sticky, fixed to the top of the page. This is done by wrapping the header template part in a group block and setting the position of the group to sticky. To do this site-wide you need to go through every template and wrap the header in a sticky group. If you forget one template or introduce a new custom post type with a new template, you don't have a consistent design across the whole site. At some point you decide to no longer have a sticky header, again this involves editing every template to ungroup every instance of the header template part.
A vertical side header. This can be accomplished by using columns (or a row or grid block perhaps) and then inserting the header template part in the first column (or second column if you want it right aligned), and you probably want to give the first column a defined width of say 300px or 20% for example. The content or query block would then go in the second column. Now you need to repeat this for every template. You then change the default font size or block spacing or you need the menu in the side header to accommodate more items and it becomes apparent that the side header width needs increasing or decreasing, so you need to go through each and every template making sure to give the column wrapper the same width.
If there was an optional primary template, both the scenarios above could be accomplished by adding the group/columns/row/grid layout in the primary template, and then there could be something like a template block which you would add in the remaining page space. This template block would then render the appropriate template, be it single, page, index, search results, 404, custom_post_type, custom_archive etc. The individual templates wouldn't need to contain the header, or the complex site wide layout, instead they would be freed up to concentrate on just what that template is needed for e.g. post content, query loop etc. There could even be an option at the template level to opt out of the primary template hierarchy if you wanted a particular template to break away from the site wide layout.
The text was updated successfully, but these errors were encountered: