Okay
  Public Ticket #167594
Modifying Responsive.css with Child theme
Closed

Comments

  • Joel started the conversation
    Hello - I'm trying to use a Child theme to modify some CSS among other things. The problem I'm currently running into is that no matter what I do, the main Responsive CSS file seems to overwrite changes to media query styles. I've tried everything I can think of - including adding the media queries into my child theme's style.css, and creating a new copy of responsive.css within the CSS folder in the child theme, and multiple variations of importing the original file, etc... please help!
  •  982
    ThemeNectar replied

    Hey Joel!

    Here's a ticket where I explain how to dequeue and enqueue your own asset in a child theme http://themenectar.ticksy.com/ticket/136919/search/ - the example is using the init.js file, but the process is the same for the stylesheet you're looking to do.

    It would look like this:

     wp_dequeue_style( 'responsive' );
     wp_enqueue_style( 'salient-child', get_stylesheet_directory_uri() . '/css/responsive.css');

    Cheers :)

  • Joel replied

    OK thank you - this is helpful - and I had seen that other ticket before... my question now is, where should this go?  I know the initial enque/deque runs in functions.php... is the intention for me to modify that file?  A copy of it within the child theme?  Something else?  When I make a copy of that file into the child theme, everything breaks... my guess is that's happening because all the references are pointing to files that the child theme doesn't have... really appreciate your help if you can keep pointing me in the right direction.

  •  982
    ThemeNectar replied

    Hey again!

    No - the only thing needed in the functions.php file in your child theme would be this (unless you have other things to add as well of course)

     
    
    add_action( 'wp_enqueue_scripts', 'custom_responsive_css', 20 );
    function custom_responsive_css() {
        wp_dequeue_style( 'responsive' );
        wp_enqueue_style( 'salient-child', get_stylesheet_directory_uri() . '/css/responsive.css');
    }
    
    Cheers :)
  • Joel replied

    Oh yeah!  It's working!!

    Thanks so much for a great theme and for great support!

  •  982
    ThemeNectar replied

    You're very welcome :)

    Cheers!