Skip to content

Instantly share code, notes, and snippets.

@djrmom
Created November 3, 2016 13:33
Show Gist options
  • Save djrmom/159eeff45afe8405d9e5db77d36454a7 to your computer and use it in GitHub Desktop.
Save djrmom/159eeff45afe8405d9e5db77d36454a7 to your computer and use it in GitHub Desktop.
WordPress front page template hierarchy modifications
<?php
/**
* Filters frontpage_template to allow both front-page.php as default static front page template while allowing
* users to select a different template in page options, also removes front-page.php from being used for the blog index
* From discussion in https://themehybrid.slack.com/archives/general/p1474838117000393
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
function prefix_front_page_template( $template ) {
return ( is_home() || locate_template( get_page_template_slug() ) ) ? '' : $template;
}
add_filter( 'frontpage_template', 'prefix_front_page_template' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment