[Resolved] Child Theme CSS not working

Home Forums Support [Resolved] Child Theme CSS not working

Home Forums Support Child Theme CSS not working

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #839238
    Hubner TANGUY

    Hello GP Team,

    I’m trying to use custom CSS through the child theme (style.css), but it does not work. I would be grateful if you could help me with that.

    It’s a bit strange as when I have the code in the “Customizing: Additional CSS” area, everything is working fine; but if I move it to my child theme, nothing is taken into consideration.

    The other files, e.g. function.php customization in the child theme, works.

    I have read the other topics in here, and the guides at https://docs.generatepress.com/article/using-child-theme/ and https://docs.generatepress.com/article/child-theme-issues/, but I don’t manage to understand what could be wrong (I have no @import or enqueuing there).

    If it’s from any help, here is my current custom CSS (which works from the customizer, but not from the style.css child theme):

    div.us_excerpts_bottom { 
        display: none;
    }
    /* hide category name and description */
    .archive .page-header {
        display: none;
    }
    .main-navigation .resources {
        background-color: #b69823;
    }
    /* add custom sticky badge to pinned post */
    .blog .post.sticky {
        position: relative;
    }
    
    .blog .post.sticky:before {
        content: url("https://howtogetref.com/wp-content/uploads/2019/03/stickypost-wpfont.png");
        position: absolute;
        top: 0;
        left: 1px;
    }

    And here is the current function PHP file in the child theme (working fine):

    <?php
    /**
     * GeneratePress child theme functions and definitions.
     *
     * Add your custom PHP in this file. 
     * Only edit this file if you have direct access to it on your server (to fix errors if they happen).
     */
    
    // Disable Admin Bar
    
    add_filter('show_admin_bar', '__return_false');
    
    // Function to return user count and shortcode for it
    function wpb_user_count() { 
    $usercount = count_users();
    $result = $usercount['total_users']; 
    return $result; 
    } 
    add_shortcode('user_count', 'wpb_user_count');

    Thanks in advance,
    Tanguy H.

    #839299
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Any chance you can add some CSS to the child theme so I can check why it’s not working?

    Let me know πŸ™‚

    #839496
    Hubner TANGUY

    Hello Tom,

    Yes, I just moved some of the CSS from the customizer to the style.css child theme:

    .main-navigation .resources {
        background-color: #b69823;
    }

    (which is supposed to make the “resources” button in the menu turn yellow, but this only works when it’s in the customizer).

    Let me know if that helps to debug the issue.

    Thanks in advance πŸ™‚
    Tanguy H.

    #839606
    David
    Staff
    Customer Support

    Hi there,

    can you double check that the stylesheet saved with that CSS as currently i am seeing an empty style sheet? Maybe try clearing server caches if the problem still persists.

    #839627
    Hubner TANGUY

    Hello David,

    I checked and everything is fine (it was maybe the cache).

    But I progressed in understanding my issue:
    if I exclude the “.css” extension from my CDN (the plugin is “CDN Enabler”, and I use KeyCDN).
    The CSS code from my child theme style.css is then working…

    It’s less related to GeneratePress than I thought, it seems. But if you have any idea about the reason and how to solve that (without excluding .css from CDN) it would be appreciated πŸ™‚

    Thank you,
    Tanguy H.

    #839636
    David
    Staff
    Customer Support

    I am not that well informed with CDN enabler. I know CDNs can take a while to propagate changes and they can also grab cached files. Might be worth asking the plugin author πŸ™‚

    #839667
    Hubner TANGUY

    Alright, I will explore that with them. Thank you.

    Enjoy your day,
    Tanguy H.

    #839675
    David
    Staff
    Customer Support

    You’re welcome. You too

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