Skip to content

Instantly share code, notes, and snippets.

@isuke01
Created September 7, 2018 10:39
Show Gist options
  • Save isuke01/7f7838de0571df0bcd78504ee4ecbd3a to your computer and use it in GitHub Desktop.
Save isuke01/7f7838de0571df0bcd78504ee4ecbd3a to your computer and use it in GitHub Desktop.
Template override, simple override template file of page, based on page ID
<?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