This tutorial answers this question:
I need to recreate several new templates for my theme. I’m brand new to the Genesis framework even though I’ve been using WP for years. The page templates don’t look like I’m used to. I’m used to seeing more HTML on the pages. Is it possible to create custom pages and do you have any resources you could recommend on how to do so?
My Answer
I think the best examples of custom page templates for Genesis are included in StudioPress themes.
You’ll find many different types of templates in different child themes.
A template file usually includes the following:
- An opening PHP tag
- A page template header
- Then code to add, remove & modify existing functions
- Then the genesis function tag at the very end of the file
Here’s a very basic example of a landing page template.
The most basic example included in most genesis child themes is the page_landing.php template. You can copy and rename this template as a good starting point. Then use the StudioPress code examples to customise the template.
The above template code includes the following:
- Includes an opening PHP tag to start parsing PHP code
-
A page template header which enables you to select this file from the Page Attributes box on any Edit Page screen.
-
Code to add a custom body class which enables you to style any page which uses this template without effecting the styling of any other pages.
-
Code to force a full width layout that removes the sidebar widget area. Code to remove navigation menus and code to remove the footer widgets. All code is only executed on pages using this template.
-
Finally, at the very end of the file you’ll find the genesis loop tag which executes the markup and other code which uses action hooks you’d normally see in a traditional template file. This is why genesis templates and files may look different to what you’re used to seeing in parent themes.
StudioPress themes include templates you can generally use in any other Genesis child theme. Use of some templates may require you to also add the CSS which styles the classes generated by PHP code in different page templates and files.
Was This Tutorial Helpful?