• Resolved killian1726

    (@killian1726)


    Hello, I am currently working on a wordpress website which is using quite a few plugins (bbPress, GravityForm, WooCommerce, SupportCandy, and others…)

    Now I’d like to edit some files inside these plugins, and I know that editing theme directly in the “wp-content/plugins/” folder is NOT the way to go, therefore I’ve created a child theme for my website (until there everything is clear).

    The method I’m currently using to edit the plugin files is that I copy the file I want to edit inside my “wp-content/plugins/” folder, and I paste it in my “wp-content/themes/childTheme/” folder, and it works well !
    But the thing is as I said I’m using quite a few plugins therefore my “wp-content/themes/childTheme/” folder is getting quite messy and might not be clear for future devs to come after me.
    What I’d love to do then is to have my plugin files organized in folders in my “wp-content/themes/childTheme/” directory for it to be more clear (for example have a “bbPress” folder, a “supportCandy” folder, etc…)

    I’ve tried importing the entire template folders of my plugins inside my childTheme folder, but it doesn’t work, it seems like the files need to be located directly at the root of my “wp-content/themes/childTheme/” folder.

    Does anybody know a way to fix this problem and organize my childTheme files better? Any information would be appreciated ! ??

    • This topic was modified 4 years, 7 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    There is no such thing as a “child plugin” so

    The method I’m currently using to edit the plugin files is that I copy the file I want to edit inside my “wp-content/plugins/” folder, and I paste it in my “wp-content/themes/childTheme/” folder,

    will not work.

    Plugins are not part of themes.

    You should make your changes in your own plugin (specific to that site), not a child theme.

    Thread Starter killian1726

    (@killian1726)

    Alright, but won’t my changes be overwriten once I will need to update the plugin to a new version?

    Thank you for your answers by the way

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Yes. So, don’t update the plugin. ??

    make your changes in your own plugin

    Don’t change other people’s code (like core WordPress or plugins). Make your own plugin that extends core or plugins, so that the originals can still be updated without losing your changes.
    It’s like making a child theme, but better, since you can still switch themes.
    You can also request that the plugin add options or fix problems with their code, so that all their users benefit, not just you.

    Thread Starter killian1726

    (@killian1726)

    Alright I understand better now, thank you very much !

    I arrived at this thread because I too need to edit a plugin file. I copied that file to my child theme and I was hoping to find a way to get that file to override the plugin’s direct file.

    The OP says that he’s doing the same and that it’s working for him but is asking if there was a better way to organize these files.

    @sterndata tells the OP that the method that is already working for him won’t work.

    @joyously tells him that he should make your changes in his own plugin (specific to that site), not a child theme.

    I’m so confused now. Whether it works or not should we NOT be copying plugin files into the child theme folder? If this is the case, joy can you please elaborate a little further on your explanation? How do you make your own plugin? How do you get it to extend core or plugins? Where does this directory sit?

    Sorry for all the questions, but I’d really love to get this task completed.

    Whether it works or not should we NOT be copying plugin files into the child theme folder?

    There are a lot of ways to do things that might work, but are not a good idea for long term maintenance.
    My suggestion to keep theme stuff separate from plugin stuff is so that you can always switch themes when you need to (testing with default theme, theme gets hacked, site needs a new look). Themes should only affect the look of the site, not the functionality.

    If you make your own plugin (from scratch or just copying one and renaming), it won’t be overwritten by updates of the original (which could be a bad thing for security issues or a good thing if you made extensive changes).

    If you don’t understand the way WP hooks work, and how to extend code without changing it, you need to read more first (Plugin Handbook and Code Reference) or stick to using existing plugins and ask the author to fix the problems.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Editing plugin files in Child Theme’ is closed to new replies.