1

I've only found one post on this and the OP asked for clarification, but didn't get any: https://wordpress.stackexchange.com/questions/180845/how-to-enqueue-both-style-css-and-style-mobile-css-in-child-theme

I'm using a pretty standard theme and have set up the Child Theme through the enqueue function in my functions.php file in my child theme.

My question is: the main theme also has a /css/style-mobile.css which, i believe is quite standard. If I wanted to make modifications to this, how would I bring it into my child theme?

  • I'm assuming I have to refer to it in the functions.php file, how would I do that?
  • Does it work like the main CSS that I only put in it the styles I want overriden? Or do I keep the entirety and change the bits I need changing?

Thank you! CC

1

It is mostly matter of personal preference how to structure this.

The typical approaches are:

  • CSS import (used to be popular, but considered kind of meh now);
  • enqueue parent stylesheet as dependency and customize with rules in your stylesheet (more files, less trouble);
  • copy parent stylesheet into child completely either once or repeatedly via build tools (less files, more trouble).

If you go with enqueue you can retrieve URL to parent theme with get_template_directory_uri() function.

  • Thank you. Yes, I was referring to the enqueue method. It works fine for the main CSS file. But for the mobile CSS specific file, I'm assuming I have to append a 2nd function (to address the mobile CSS sheet) to the main function. I've tried a couple things I've found on the web, but I'm not sure I'm doing it right. - Can you help me with the code, what should it be? - Then do I put the full mobile CSS file in my child theme and edit the styles I want to edit? Or do I do what we do with the main CSS file and only put in the styles we want to override? – CosmoChick May 30 '16 at 22:59
  • That's a lot of question marks. I would recommend to update your question with your progress. As per my answer there are multiple and very different approaches to get this done. It's not quite practical to try decide what's exactly fitting to your specific case. Share your progress, focus on specific roadblocks. – Rarst May 30 '16 at 23:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.