10up / wp-scaffold

10up WordPress project scaffold.
MIT License
194 stars 46 forks source link

Add Child Theme Support #46

Open bengreeley opened 3 years ago

bengreeley commented 3 years ago

Currently the scaffolded theme in the scaffold works well when the theme is used as a parent theme, but requires modification to work as a child theme. I'd like to propose we make some minor function changes in the theme to make sure it's ready to be used across a variety of types of themes.

The functions get_template_directory_uri() and get_template_directory() could be replaced with get_stylesheet_directory_uri() and get_stylesheet_directory() to work with child themes.

claytoncollie commented 3 years ago

@bengreeley I looked at this issue and I don't think changing those functions is the way to go. I followed your suggestions, installed a child theme, and broke the site due to core.php not loading properly on the parent theme in the functions.php file.

I started a pull request for this issue at #50 with my suggested changes. So far I am following the naming convention for script and style handles set by the 10up-plugin so that the child theme can load the parent styles properly as noted in the Core handbook. Feel free to send me some more direction and I can try to implement it.

claytoncollie commented 3 years ago

@bengreeley After thinking about this more today, you are saying the scaffolded theme should be able to be used as a child theme. I read it as the scaffolded theme is the parent theme and then support needs to be added to then layer a child theme on top. I'll do some testing for both scenarios and put it into my PR.

bengreeley commented 2 years ago

Hey @claytoncollie thanks so much for putting this PR together! I found some issues with it, which I'll log below. For my testing I cloned your branch and grabbed the theme folder and added * Template: twentytwenty to style.css to be a child theme of TwentyTwenty.

Issues: