Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Adding a custom page template

Koen edited this page Aug 1, 2019 · 7 revisions

Sometimes you need a specific template for regular pages. In that you can use custom page templates, which can be chosen in the Page Attributes metabox on any page and post types that support it.

Adding a custom page template

  • Create a called template-<name>.php (example), and make sure the name of the template is in the PHP comment in top of the file
  • Create a Twig template in templates/templates/<name>-template.twig (example), and reference it from the PHP template
  • In the CMS add the template to anything that allows setting a custom template via the Page Attributes metabox

Note that changing the name of the PHP template removes it from any linked page and ACF groups.


See also: