WordPress.org

Ready to get started?Download WordPress

Forums

Child theme and Plugins (5 posts)

  1. petriknz
    Member
    Posted 1 year ago #

    I have a child theme set up and the site has the eshop plugin installed. But now I need to change the look of eshop. I know I can do this by going to the Plugin editor to edit the plugin css file but then I overwrite the plugin files. So when I get a plugin update I will lose the changes. Is there such a thing as a "child" for plugins. If so how do I implament it?

    If not what is the solution to not losing your changes everytime you update the plugin?

  2. You can still make changes to your child theme which will affect the plugins. It's a little different depending on whether you are wanting to adjust CSS or PHP though.

    If it's CSS, you can add the styles for any plugins to your stylesheet and they will get called on the same page. I think a child theme gets called last in the sequence... but if you notice your changes aren't sticking... you might want to use the !important declaration just to make sure.

    If it's PHP you're wanting to adjust... you'll need to know if the plugin uses any custom hooks or filters.. and "hook" into them accordingly via your child theme functions.php file.

  3. petriknz
    Member
    Posted 1 year ago #

    I did try putting CSS from the plugin directly in to the Child CSS file but it didn't appear to do anything. I'll have another go just in case I was adjusting something other then what I thought I was working on.

  4. michael.mariart
    Member
    Posted 1 year ago #

    Changing CSS will depend on where the rules are in the file, and the order that file is loaded compared to the other files. If your stylesheet is loaded before the plugins stylesheet, then the plugins stylesheet will over-write any changes that you try to make.

    The most common way around this is to add an !important declaration to the rule. As an examle:

    p.my_class_name {
        color: #FF0000 !important;
    }
  5. Also be sure to refresh your browser cache and empty any caching plugins you might be using when working with CSS and viewing changes.

Topic Closed

This topic has been closed to new replies.

About this Topic