Created
September 7, 2018 10:39
-
-
Save isuke01/7f7838de0571df0bcd78504ee4ecbd3a to your computer and use it in GitHub Desktop.
Template override, simple override template file of page, based on page ID
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
<?php | |
add_filter( 'template_include', 'archives_overrides', 99 ); | |
function archives_overrides( $template ) { | |
global $post; | |
if(!$post){ return $template; } | |
if ( $post->ID == get_archive_for_projects() ) { | |
$new_template = locate_template( array( 'template-projects.php' ) ); | |
if ( '' != $new_template ) { return $new_template ; } | |
} | |
return $template; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment