How to Remove the Genesis Page Templates

Genesis comes preloaded with two page templates. The Blog page template allows you to display your posts using a custom loop. See this post on why I don’t recommend you use it.

The Archive page template provides links to your pages, posts, authors, categories, and month archives. I don’t really like this page either because it displays information I don’t care about (authors, month archives) and doesn’t display information I do (any custom post types I’ve built). If I want something similar to this, I create a standard page and use Column Classes and Display Posts Shortcode to list whatever content I like. See my Tutorials section as an example.

Even though I don’t want these templates, I’ve been stuck with them since they’re in Genesis. When a client asks “When should I use this Blog page template?” I’d have to explain why not to use it. If there are features of WordPress or Genesis I don’t want my client to use, I like to remove them so there’s no confusion.

Thanks to this ticket committed in WordPress 3.9, I can now remove the page templates I don’t want in Genesis using this in my child theme’s functions.php file:

<?php
/**
* Remove Genesis Page Templates
*
* @author Bill Erickson
* @link http://www.billerickson.net/remove-genesis-page-templates
*
* @param array $page_templates
* @return array
*/
function be_remove_genesis_page_templates( $page_templates ) {
unset( $page_templates['page_archive.php'] );
unset( $page_templates['page_blog.php'] );
return $page_templates;
}
add_filter( 'theme_page_templates', 'be_remove_genesis_page_templates' );
view raw functions.php hosted with ❤ by GitHub

Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributing developer to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.

Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk

Reader Interactions

Comments

  1. Thanks Bill. Another gem to implement on our customized child theme (which we thought about naming Mr. Bill in your honor, but we went with Weatherby–our dog–instead.) Your tutorials and tips are very much appreciated, and–with so much online WP cruft that isnt credible–it’s nice to know we can trust your examples too. Thanks again.

  2. Thanks Bill! Enjoyed your class at WordCamp Austin this past weekend. So glad you’re on Genesis.

    • Glad you made it to the talk! I’ll be writing a post about what I discussed soon, so if you have any more questions or issues please ask.

  3. I read your previous article on why you hate those templates as well. I have a question –

    When you’ll unset these templates, in condition when they are needed, WordPress default templates for the same would be called, right?

    and when you need to make some custom /blog or /home page, then you create them as home.php (with custom code) and front-page.php (with custom code) and then they will override the WP default templates being served (after unsetting the genesis templates). right?

    Thanks for the writeup!

    • This filter only applies to “page templates”. Those are files that have /* Template Name: xyz */ at the top, and can be used only on pages.

      This has nothing to do with the home.php and front-page.php files. That’s all handled by the Template Hierarchy.

  4. bill,
    so do you prefer to hard code a template for displaying posts for clients or use dp shortcodes and potentially let the client delete that in a page?

    • I prefer to use the posts page that WordPress itself provides. Create a page, then go to Settings > Reading and set that as the posts page.

      The blog page template only exists in Genesis because early on StudioPress’ themes incorrectly used home.php for static front pages, when that file should be used for blogs.

      See this post for more information

  5. Thank’s for your tips! Is it possible to remove “landing page” template the same way? Couldn’t find the filename ((

    • Landing page is a template I added to my child theme. It’s not in Genesis. So if you don’t want it and it’s in your child theme, just delete the template file.

  6. YES! Haven’t checked in as often as I should and to come back and see this! Woo Hoo finally, great and thank you.

  7. Very cool, I had always wondered why those two surplus templates were available on the edit page screen.

    One thing I did wonder, is there a way to have the custom template dropdown appear on the edit post category or custom taxonomy screen as it does on Thesis? I know we have the layout options but if I wanted to have 4 templates as options for archives the layouts approach does not suffice. Any ideas?

    • Page Templates are just that – templates specifically for the ‘page’ post type. If you want these page templates available to posts, you can use this plugin.

      It doesn’t really make sense to have the page template dropdown on taxonomies like ‘category’ or any custom one you made. Page templates are designed for single pages of content ( is_page() ), not for archives of content. But you could build this yourself. I’d manually specify a list of templates that apply solely to taxonomies, rather than making page templates also apply to taxonomies.

      Two options I see:
      1) Create a metabox on the Edit Term page (CMB2 + Taxonomy_Metadata). Use template_include filter to specify template based on their selection.
      2) Add custom layout options to Genesis, saving you from having to build your own custom metabox and template filter.

  8. Hi Bill,
    I’ve noticed that I have to add a priority higher than 10 to get this work now.

    add_filter( ‘theme_page_templates’, ‘be_remove_genesis_page_templates’ , 20, 1);

    Any priority over 10 works.

    Running Genesis 2.5.2 and WP 4.8

    Anyone else notice this?

  9. Super great tutorial, thanks!

    I really prefer only seeing what I and my clients need to see.

    :o)

Leave A Reply