Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'template_include', 'include_template_function', 1 );
- function include_template_function( $template_path ) {
- if ( get_post_type() == 'movie_reviews' ) {
- if ( is_single() ) {
- // checks if the file exists in the theme first,
- // otherwise serve the file from the plugin
- if ( $theme_file = locate_template( array ( 'single-movie_reviews.php' ) ) ) {
- $template_path = $theme_file;
- } else {
- $template_path = plugin_dir_path( __FILE__ ) . '/single-movie_reviews.php';
- }
- }
- }
- return $template_path;
- }
Add Comment
Please, Sign In to add comment