Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #658262

    Hope you can help, I’m losing my mind a little over here. I have used Enfold countless times with Custom Post Types no problem. This time, for some reason I cannot figure out where the template is coming from for the single post, so I am unable to edit whichever it is. I have added little tracer classes in various places to see what it is using but can’t find it.
    the facts:
    Child theme, I am establishing the CPT for ‘books’ in a custom plugin.
    The CPT: http://screencast.com/t/UrG3A9OWoplR (I have commented out and in nearly every parameter to test).
    In the Child theme I have single-books.php which is being ignored.
    HOWEVER, it is not using the single.php from the parent theme either! even though the body classes say single, and single-books.
    I have added classes to archive.php, page.php, and it is not using those either.
    I have flushed the permalinks many times in every method and order possible and even put flush_rewrite_rules() in the CPT.
    I have switched to twenty fifteen and the CPT is using the normal single.php in that case. When I activate enfold or my child theme, it becomes a mystery because it is not using single.php or single-books.php.
    http://screencast.com/t/nwbuXkOuX
    http://screencast.com/t/0pSS2gL2bSzT

    #658541

    Hi mickfollari,

    You can add the following to your functions.php file to see what template is being used:

    add_action('wp_head', 'show_template');
    function show_template(){
    global $template;
    print_r($template);
    }

    Thanks,
    Rikard

    #658611

    Thanks Rikard. I see now that it’s showing this: /dev/wp-content/themes/enfold/template-builder.php. I can see what that file is doing, but have never encountered it before. Normal blog posts use single.php I’m not sure why this CPT is directing to that file instead of either single.php or single-books.php. Any ideas? is it something in my CPT declaration?

    #658613

    Just as an FYI and for anyone else, I just added this to the top of the template-builder.php file in my Child Theme:
    if ( is_singular( ‘books’ ) ) {
    get_template_part( ‘single-books’ ); exit();
    }

    and caused the correct template to be used, so I think it’s fine now, but still confused why it’s not using the single-books.php right away.

    #658932

    Hi,

    Great, glad you got it working and thanks for sharing your solution. Please let us know if you should need any more help on the topic.

    Regards,
    Rikard

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.