Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #890881
    Anonymous
    Inactive

    Hi,

    I am wondering where I am supposed to save the new or edited css (or javascript) when a child theme is activated, so that there are no changes when updating wordpress or the parent theme. Should I save CSS in the style.css file that comes with x-child, or it is fine to save CSS in the Custom Section in WordPress. I noticed that when I save CSS in the the Custom Section, the changes are applied to the theme but they are not saved in the style.css in x-child. Is that normal? If the new CSS is not saved there, does it prevent the theme customization from changing when updating?

    Thanks!

    #891580
    Lely
    Moderator

    Hi There,

    We can save custom CSS in Appearance > Customize > Custom > CSS > Custom Code > Edit Global CSS. This will be save in the database and not on child theme style.css file. Yes, that is normal Other option is to save it on style.css file of child theme. Both of those CSS will stay intact when you update the theme. Javascript should be added on child theme’s functions.php like below:

    
    function custom_js_code() { ?>
    
      <script>
        //  JAVASCRIPT CODE HERE
      </script>
    
    <?php }
    
    add_action( 'wp_footer', 'custom_js_code' );

    Hope this helps.

    #892144
    Anonymous
    Inactive

    Yes, this helps. Thanks a lot.

    #892923
    Prasant Rai
    Moderator

    You are most welcome. 🙂

  • <script> jQuery(function($){ $("#no-reply-890881 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>