Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm creating a new WP website based on a template, and I've created the child theme for this template. It is working without any problem. I understand the basics for a child theme as adding my style.css, function.php, etc. I need to get a better understanding on the following points:

  • For plugins installation, will I install it using the child theme, or install in the parent theme? And will it be in /wp-content/plugins or do I need to create another folder and add some function to it to make it work.

  • If I have a file inside more than one folder in the parent theme (example /parenttheme/includes/php/anotherfolder/example.php) and I want to modify the example.php file, do I need to create and match all this structure in the child theme only?, or do I need to add more function to make it work.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

A general note: A lot of things in WordPress can be configured. For example the name of the wp-content directory. The same goes for the name of the plugins and themes directory. And both can have multiple folders (with plugins defining them).

About child themes and plugins: A plugin and a theme is (in general) pretty much the same thing. The (main) difference just is where they get loaded and which info they have for WordPress (in comment headers). And they aren't connected structurally. So a child theme has nothing to do with a plugin.

Simple rule:

A plugin adds functionality. A theme adds visual representation.

Keeping this separated makes the theme easily exchangeable - and single functionality (each wrapped in a single plugin) as well.

About matching structure from parent > child theme: Yes, you will have to recreate that structure. But only if child theme inheritance is built into the parent theme. For e.g. a stylesheet loaded with get_template_directory_uri() will only load from the parent theme, while the _stylsheet_() counter part will use the one from the child theme. Things like get_header(), get_sidebar(), get_footer() or get_template_part() will search in the child theme first. And a child themes functions.php is also loaded before the parent themes functions.php file.

share|improve this answer
    
thank you, but if i want to modify a plugin, and when updating i don't lose mu modification ( same principle of child theme) what i must do ? –  Ahmed Na Aug 10 at 15:42
    
@AhmedNa Please don't mark something as a solution if it is none (yet). About your problem: I thought it was about modifying/overwriting functionality of a (parent) theme in a child theme? Is it now about overwriting the functionality of a plugin? –  kaiser Aug 10 at 16:51
    
@Kiser you answered my main question, but this one came to my mind while i was working yesterday, so i think that i can ask you because it's similar to the question you answered. also i will make it as a question. Thanks –  Ahmed Na Aug 11 at 4:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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