Created
December 2, 2013 00:09
-
-
Save chriskoelle/7742659 to your computer and use it in GitHub Desktop.
This changes the Wordpress template hierarchy to use archive.php instead of home.php for the posts page if the front page settings are set to display a static page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Archive Template for Posts Page | |
* | |
* This changes the Wordpress template hierarchy to use archive.php for the posts page | |
* | |
* @author Chris Koelle | |
* | |
* @param string $template | |
* @return string | |
*/ | |
function nh_posts_page_archive_template( $template ) { | |
global $wp_query; | |
if( $wp_query->is_posts_page && get_query_template( 'archive' ) !== '' ) | |
$template = get_query_template( 'archive' ); | |
return $template; | |
} | |
add_filter( 'template_include', 'nh_posts_page_archive_template' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment