WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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:


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


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.