wordpress 3.4 template files in subdirectories

i’ve been organizing my sites template files into a sub directory, which is now possible with wordpress 3.4. but when i move a custom post-type single file (ie. single-news.php) into the sub directory, it is not recognized. anybody have any experience with this new feature?

Related posts

Leave a Reply

2 comments

  1. The solution shared in this answer on StackOverflow works for me:

    https://stackoverflow.com/questions/4647604/wp-use-file-in-plugin-directory-as-custom-page-template#answer-8255556

    function get_book_post_type_template($single_template) {
        global $post;
    
        if ($post->post_type == 'books') {
            $single_template = dirname( __FILE__ ) . '/themefiles/single-books.php';
        }
        return $single_template;
    }
    
    add_filter( "single_template", "get_book_post_type_template" ) ;