Adding new templates

How to add new templates?

Please, if you haven’t first read this section

Because Zero One is a theme made as a plugin, you can override every plugin file with the same name and file in the site/theme folder. But it must be in the same folder structure as in the plugin.

Let’s say you want to add a new template called “books”:

  • Create a template first

    • Add a new site/theme/blueprints/pages/books.yml file for the page blueprint

    • Then add a new site/theme/templates/books.php file for the template code

  • Include the template in the main pages (main dashboard, highest level pages)

    • Copy site/plugins/zero-one/blueprints/tabs/site-content.yml file

    • To site/theme/blueprints/tabs/ folder (create blueprints and tabs folders, of course), so you get site/theme/blueprints/tabs/site-content.yml file

    • Open the file with the code editor and add the “books” template name in the allowed templates for both Draft templates and Published templates

    • And that’s it! Test it and you will see your new template.

  • Include the template to subpages:

    • Copy site/plugins/zero-one/blueprints/sections/page-draft.yml file

    • To site/theme/blueprints/sections/ folder (create folders), to get site/theme/blueprints/sections/page-draft.yml file

    • Open that new file and add the “books” template to the allowed templates list

    • Do the same with site/plugins/zero-one/blueprints/sections/page-published.yml file (copy it to, and change it like you did with page-draft.yml file)

When you follow this approach, even when you update Zero One to the new version, your changes will be untouched.

For the page template, we suggest you check:

  • site/plugins/zero-one/blueprints/pages/default.yml

  • And site/plugins/zero-one/templates/default.php

And maybe use that template as your base for further extension/customization.

Last updated