• Resolved Krissy

    (@krissy)


    My client has a child theme built off of “Roots”, I’ve gone through the entire Codex but can’t seem to locate what I’m looking for.

    I need to change the output of the single.php file. When the child theme was built a single.php file was not included in the theme. I’ve loaded one to the child theme but it is not allowing me to overwrite the surrounding attributes (header/footer).

    Per the codex, uploading a header.php or footer.php file should overwrite what the master theme is trying to do. However, that doesn’t seem to be the case here. Regardless of whether or not I even include a header/footer call on single.php, it’s still showing up without the desired template around it.

    Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Roots is one big framework, it does its thing its own way.

    Roots templating
    https://github.com/leoj3n/roots/tree/templating

    I’d go to its main site and read the doc there.

    Thread Starter Krissy

    (@krissy)

    Thank you Paul.

    I was actually able to resolve it on my own. The overall theme is formatted with the BASE.PHP file…that’s pretty much the header/footer built into one. I was able to if-statement the header so that it displayed a different series of file if_single.

    To anyone having a similar issue with Roots, this is the only way I could think to fix it.

    <?php
    if(is_single()){include("single.php");exit;}
    get_template_part('templates/head'); ?>

    Just replace Line 1 with this code on base.php and you should be good to go. I imagine it works on any is_ variation, but I only needed it for Single.

    My client has a child theme built off of “Roots”, I’ve gone through the entire Codex but can’t seem to locate what I’m looking for.

    I was actually able to resolve it on my own. The overall theme is formatted with the BASE.PHP file…

    Thanks for asking your question, and even more for providing us with a possible solution. Following this discussion has lead me to do some research of my own and I discovered Shoestrap. It’s a fork of the Roots theme with a bunch of improvements. One nice thing about it is the extensible support through hooks.

    As written in the README on GitHub, one can easily override the template for single posts by using the following code:

    function my_custom_single_content() {
        // CONTENT HERE
    }
    add_action( 'shoestrap_content_single_override', 'my_custom_single_content' );

    More information can be found at shoestrap.org. I hope I have helped someone.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Child Theme – Template Overrides’ is closed to new replies.