0

I have a website which is using a child theme of Twenty Twelve.
As part of the design process, I had to edit /twentytwelve/css/ie.css.

Is it possible to save this file in my child theme, and keep twentytwelve's version as it was by default? This would ensure if Twenty Twelve is ever updated, I won't lose the changes I made to /twentytwelve/css/ie.css.

1 Answer 1

0

For ie.css specifically, the issue is that it is included via get_template_directory_uri(), which will output the parent theme directory when a child theme is being used. The solution is to add an action hooked to wp_enqueue_scripts with a lower priority, dequeue the stylesheet, then re-enqueue it using get_stylesheet_directory_uri(), which will load it from the child theme directory.

3
  • How do I add an action hooked to wp_enqueue_scripts with a lower priority? How do I re-enqueue it using get_stylesheet_directory_uri()? In what file do I do this?
    – Steve
    Commented Jul 11, 2013 at 10:42
  • see priority argument of add_action. look in twentytwelve functions.php for where they enqueue the css file, copy it to your child theme's functions.php, swap get_template_directory_uri for get_stylesheet_directory_uri.
    – Milo
    Commented Jul 11, 2013 at 15:14
  • Thanks. I now know about the priority argument of add_action, but what do you mean by "add an action hooked to wp_enqueue_scripts with a lower priority?". What action? In what file do I do this?
    – Steve
    Commented Jul 12, 2013 at 1:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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