Tagged: responsive
- This topic has 7 replies, 3 voices, and was last updated 9 years, 2 months ago by Sakin.
-
AuthorPosts
-
February 10, 2015 at 3:59 am #51410sandra1970Participant
Hello!
I have created a responsive.css in my child theme (just copy-paste – not sure if I need to add an @import line). I understood from a thread in the kathmandu theme that I need to add some code to the child function.php file for it to work, but with the kathmandu example in hand, I cannot seem to figure it out.
Can you help me do that?
Thanks a million!
Sandra
February 10, 2015 at 9:35 am #51425SakinKeymaster@Sandra1970: For adventurous theme, if you want to remove the parent theme responsive css and add your own child theme responsive.css file. Then you need to add the following code in you child theme functions.php file.
// Remove Parent theme responsive.css and adding new responsive.css in child theme function adventurous_child_enqueue_scripts() { wp_dequeue_style( 'adventurous-responsive' ); wp_enqueue_style( 'adventurous-child-responsive', get_stylesheet_directory_uri() . '/responsive.css' ); } add_action( 'wp_enqueue_scripts', 'adventurous_child_enqueue_scripts', 11 );
February 11, 2015 at 1:20 am #51466sandra1970ParticipantIt worked! Thank you so much!
February 13, 2015 at 2:31 am #51612SakinKeymaster@Sandra1970: Thanks for your appreciation.
February 13, 2015 at 10:29 pm #51685RonelMemberHello
I have a follow-up question to this:
I only want to change a very small piece of the responsive css. Is it possible to somehow enqueue my responsive css file to load after the parent responsive css, so that I don’t have to copy the whole file?Regards,
RonelFebruary 13, 2015 at 10:51 pm #51692SakinKeymaster@Ronel: Best option is to copy the whole css from parent theme responsive.css and then add your custom below. As the code I gave you will remove the parent theme responsive.css and then add your child theme responsive.css
But if you want to create new responsive.css in your child theme with only few css that you want to edit. Then you don’t need to remove parent theme css. You just need to add your child theme responsive.css by adding in the following code in your child theme functions.php file.
// dding new responsive.css in child theme function adventurous_child_enqueue_scripts() { wp_enqueue_style( 'adventurous-child-responsive', get_stylesheet_directory_uri() . '/responsive.css' ); } add_action( 'wp_enqueue_scripts', 'adventurous_child_enqueue_scripts', 11 );
February 13, 2015 at 10:53 pm #51693RonelMemberOh, duh! Just don’t dequeue the parent file and enqueue the child file with priority 11.
Don’t mind me, I’ve got it working.
February 13, 2015 at 10:55 pm #51694SakinKeymaster@Ronel: Yes you are right 🙂
-
AuthorPosts
- The topic ‘Responsive.css not active in child theme’ is closed to new replies.