Open bengreeley opened 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.
@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.
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:
failed to open stream: No such file or directory in /var/www/html/wp-content/themes/10up-theme/functions.php on line 17
. What it looks like is going on is the variable TENUP_THEME_INC
is using get_template_directory()
, which refers to the main parent theme. If we use get_stylesheet_directory()
instead it should resolve it and refer to the child theme.get_template_directory_uri()
. We'll probably want to consider using get_stylesheet_directory_uri()
instead so it'll refer to the child theme files.
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()
andget_template_directory()
could be replaced withget_stylesheet_directory_uri()
andget_stylesheet_directory()
to work with child themes.