Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Child Theme Support #46

Open
bengreeley opened this issue Jul 1, 2021 · 3 comments · May be fixed by #50
Open

Add Child Theme Support #46

bengreeley opened this issue Jul 1, 2021 · 3 comments · May be fixed by #50
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@bengreeley
Copy link
Contributor

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.

@bengreeley bengreeley added bug Something isn't working good first issue Good for newcomers labels Jul 1, 2021
@claytoncollie claytoncollie linked a pull request Aug 25, 2021 that will close this issue
6 tasks
@claytoncollie
Copy link
Contributor

@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
Copy link
Contributor

claytoncollie commented Aug 26, 2021

@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.

@claytoncollie claytoncollie linked a pull request Aug 27, 2021 that will close this issue
6 tasks
@bengreeley
Copy link
Contributor Author

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:

  • When activating the child theme I get an error 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.
  • Likewise, TENUP_THEME_TEMPLATE_URL is set to use 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants