Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

Yeah only the page templates are recognized & not the archive,single etc. templates. Your single file has to remain in the root folder.

share|improve this answer

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

http://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" ) ;
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.