Last active
August 29, 2015 14:15
-
-
Save afuggetta/709ba81c70b301fe4df2 to your computer and use it in GitHub Desktop.
Custom post type template loading
This file contains hidden or 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( '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