简体   繁体   中英

How to properly create a child theme structure

I've read some articles and I've understood that there are Child theme files, that could totally override the Main theme files but others not (like function.php for example). At this point, will be good to know which files could be included in the Child theme and how (regarding the folder structure).

Most of my modifications are made in custom css Main theme special field, but also I've modified directly app.css , app.min.js ​, header.php , script-calls.php (registering additional js files and applying some tweaks)​.

I have to mention that in my case, stylesheets are enqueued using inc/script-calls.php not function.php file.

All the files (no matter what extension) could be treated in the same way, Is that ok if I simply copy these files into the Child theme folder or should I create an exact directory structure, like we have in the Main theme please?

Thank you,

LE: I am struggling to make it work but without result. I recreate the same folder structure trying to use these files in the child: app.css , app.min.js ​, header.php , script-calls.php and the only file that is working it's header.php . Any thoughts?

You have to follow the directory structure of the Parent theme in the child theme folder.

If your Parent theme structure is:

/parent-theme/templates/single.php

To replace the single.php in the child theme folder you must create:

/child-theme/templates/single.php

Any file can be included in your child theme. you can also include additional files that are not loaded in the parent theme.

https://codex.wordpress.org/Child_Themes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM