Guest User

Untitled

a guest
Dec 14th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. add_filter( 'template_include', 'include_template_function', 1 );
  2.  
  3. function include_template_function( $template_path ) {
  4. if ( get_post_type() == 'movie_reviews' ) {
  5. if ( is_single() ) {
  6. // checks if the file exists in the theme first,
  7. // otherwise serve the file from the plugin
  8. if ( $theme_file = locate_template( array ( 'single-movie_reviews.php' ) ) ) {
  9. $template_path = $theme_file;
  10. } else {
  11. $template_path = plugin_dir_path( __FILE__ ) . '/single-movie_reviews.php';
  12. }
  13. }
  14. }
  15. return $template_path;
  16. }
Add Comment
Please, Sign In to add comment