How To Create Custom Page Templates For Genesis Child Themes

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:

  1. An opening PHP tag
  2. A page template header
  3. Then code to add, remove & modify existing functions
  4. Then the genesis function tag at the very end of the file

genesis-page-template

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:

  1. Includes an opening PHP tag to start parsing PHP code

  2. A page template header which enables you to select this file from the Page Attributes box on any Edit Page screen.

  3. 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.

  4. 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.

  5. 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.

Related Tutorials

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.