Skip to content

Instantly share code, notes, and snippets.

@afuggetta
Last active August 29, 2015 14:15
Show Gist options
  • Save afuggetta/709ba81c70b301fe4df2 to your computer and use it in GitHub Desktop.
Save afuggetta/709ba81c70b301fe4df2 to your computer and use it in GitHub Desktop.
Custom post type template loading
<?php
add_filter( 'single_template', array(
__CLASS__,
'get_custom_post_type_template'
), 10, 1 );
public function get_custom_post_type_template( $single_template ) {
global $post;
if ( $post->post_type == self::$_post_type ) {
$single_template = dirname( __FILE__ ) . '/../templates/template-folder/template.php';
}
return $single_template;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment