• Resolved dagnew

    (@dagnew)


    I’ve been having much difficulty with updating my child theme’s CSS. Edits made in WordPress’s Appearance / Editor would not appear in the site, although sometimes they would an hour later. I thought it was an enqueueing problem, struggled with the child functions.php code, and eventually got that to work (see below) – for a couple of hours. But the next day, changes made to the CSS from the WordPress Editor would not appear when refreshing the browser. And then suddenly, with a refresh of the browser, I lost the header image and the menus are a mess. This could be because many of my prior CSS experiments – which I thought had no effect – simply never loaded before.

    I’m quite confused, but I think these may be clues:

    • when I view page source, 13 stylesheets are listed. the 6th one’s id=’twentysixteen-style-css’; the 7th one’s id=’child-style-css’
    • In the comments of my (child) style.css file, I have:
      Description: Twenty Sixteen Child Theme
      Version: 1.0.0.1517610849
      Updated: 2018-02-02 22:34:09
      Is the ‘version’ and ‘updated’ info supposed to automatically update when the editor is used? If so, that’s not happening.

    My child functions.php code:

    <?php
    function my_theme_enqueue_styles() {
        $parent_style = 'twentysixteen-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')
        );
    }
    add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
    ?>

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    although sometimes they would an hour late

    That sounds like a caching issue. Do you have any caching plugins? Does your host do server-level caching?

    Thread Starter dagnew

    (@dagnew)

    Thank you for the reply, Steve.
    I don’t think I have any caching plugins, ‘tho I don’t know much about caching.
    I’m using these plugins:
    Debug Bar, Debug Bar, Easy Footnotes, Loginizer, Mammoth .docx converter, WP Sticky Menu.
    To find out if my host does server-level caching, do I need to ask them?

    Multiple mysterious things happened, including the header image disappearing (no header image loaded when I ‘viewed source’) – I chose a new header image from within WordPress and that was resolved, ‘tho I don’t know why it had vanished.

    But I think I may have caused 90% of my problems: I had tried many things using CSS to adjust the appearance of the header. None worked and I thought that was because I hadn’t found the proper selectors – and I left that CSS intact. I didn’t realize that the child theme’s CSS wasn’t loading. When I finally got the functions.php code right, many weird things happened when my untested CSS was suddenly loaded. Now I realize that was self-inflicted.

    Thread Starter dagnew

    (@dagnew)

    I’m not really a WordPress newbie, but I’m sure feeling like one!

    Thread Starter dagnew

    (@dagnew)

    I think this was all due to poor ‘enqueueing’ in my child’s functions.php file. Resolved.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘my child theme CSS is unreliable’ is closed to new replies.