Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_filter('template_include', 'book_template_override_filter');
- function book_template_override_filter($template) {
- if ( 'book' == get_post_type() ) {
- if ( $theme_file = locate_template(array('single-book.php')) ) {
- $file = $theme_file;
- } else {
- $file = plugin_dir_path(__FILE__) . 'views/single-book.php';
- }
- $template = $file;
- }
- return $template;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement