• Resolved mtjarrett

    (@mtjarrett)


    My child theme stylesheet is not being ‘obeyed.’ If you will run the inspector on the page http://thebordermission.org you will see that it is loading themes Hemingway and Hemingway-kid. But if you click on the stylesheet for Hemingway-kid you will see that it is calling for the Template twentynineteen. (I changed it to twnetynineteen just to see if the thing was working.)

    Any help is appreciated.

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Moderator t-p

    (@t-p)

    Is this the guide you followed to create the child theme?
    https://developer.ww.wp.xz.cn/themes/advanced-topics/child-themes/

    If not, please review it and see if you missed anything.

    Thread Starter mtjarrett

    (@mtjarrett)

    @t-p yes, that is what I followed.

    Thread Starter mtjarrett

    (@mtjarrett)

    This is what I have in my child theme style.css

    /*
     Theme Name:   Hemingway-kid
     Template:     twentynineteen
     Version:      1.0.0
     License:      GNU General Public License v2 or later
     License URI:  http://www.gnu.org/licenses/gpl-2.0.html
    
    */

    And this is what I have in my child theme functions.php

    add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
    function my_theme_enqueue_styles() {
     
        $parent_style = 'parent-style'; 
     
        wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'child-style',
            get_stylesheet_directory_uri() . '/style.css',
            array( $parent_style ),
            wp_get_theme()->get('Version')
        );
    }

    If you run the Chrome inspector on the site, you see that the style.css shows exactly what I pasted above. It declares the Template to be twentynineteen (once again for troubleshooting purposes, this is a child of Hemingway). But also in the inspector you see that Hemingway is loaded, not Twenty-Nineteen.

    This is what I can’t figure out.

    Thread Starter mtjarrett

    (@mtjarrett)

    I have turned off server caching, and I have disabled caching for Chrome. The only thing that seems to make changes is if I switch themes and then switch themes back. Does WordPress have some sort of caching system now?

    Moderator t-p

    (@t-p)

    Are you using Hemingway or twentynineteen to create a child theme?

    Thread Starter mtjarrett

    (@mtjarrett)

    I am making a child theme from Hemingway. What I was pointing out above is that my style.css is not being ‘obeyed.’ In other words, although I changed the style.css to say that the template was twentynineteen, and although Chrome was showing in the developer tools that it was receiving the correct style.css, Chrome was also showing in the developer tools that it was continuing to use Hemingway as the template.

    Additionally, if I go an change my active theme to something else and then change it back to my child theme, then the change seems to take effect.

    The only way this makes sense is if wordpress stores the template information in the database somewhere rather than reading it from my child theme style.css every time.

    • This reply was modified 7 years, 1 month ago by mtjarrett.
    Moderator t-p

    (@t-p)

    I am making a child theme from Hemingway.

    Then why are you using Template: twentynineteen !!!!!

    Thread Starter mtjarrett

    (@mtjarrett)

    @t-p

    I’m sorry if I’m being unclear. I’ll try again. I changed the template of my child theme temporarily to see if it would take effect. It did not. That is the problem I am trying to troubleshoot here.

    So for instance, when I have the template in the child theme as Hemingway, Chrome shows me in the developer tools that the style.css that it is using does in fact say Template: hemingway. Additionally, the website looks as if it is using Hemingway as its template and the developer tools also verify that the two themes being used are Hemingway and Hemingway-kid.

    If, however, I change the template in my child theme to say Template: twentynineteen. This happens – The Chrome developer tools show me that the stylesheet it is using does in fact say, Template: twentynineteen. BUT the website is still being based of of Hemingway and the Chrome developer tools verify that the two themes being used are still Hemingway and Hemingway-kid.

    Thread Starter mtjarrett

    (@mtjarrett)

    For anyone else who is having this issue, the answer is that you must change your theme and then change back. Then you will see the changes take effect.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Child theme issues’ is closed to new replies.