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' ); |
Viktor says
Super great tutorial, thanks!
I really prefer only seeing what I and my clients need to see.
:o)
Dale says
Hi Bill,
Hope you well and safe.
Can you please enlighten me if this is still applicable in Genesis V3.3.2. and would you recommend I use this snippet on a Genesis/WooCommerce site that does not use post/blog.
Also how would unsetting the page_archive.php affect WooCommerce and it’s product pages?
Would love to know.
Kind regards,
Dale
Bill Erickson says
This is no longer necessary. The archive and blog page templates were removed in Genesis 3.0 (changelog).
Unsetting the page_archive.php file should not affect WooCommerce in any way. It’s a custom page template that is not used by WooCommerce.