Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Load child theme templates before parent theme #370

Merged
merged 1 commit into from Jul 23, 2019

Conversation

lukecarbis
Copy link
Member

@lukecarbis lukecarbis commented Jul 22, 2019

Closes #334.

Tested with both child theme and parent theme template files and stylesheets.

Screen Shot 2019-07-22 at 7 20 20 pm
Screen Shot 2019-07-22 at 7 20 10 pm

My parent template looks like this:

<h3 class="css-bugfix">parent</h3>

My child template looks like this:

<h3 class="css-bugfix">child</h3>

My parent stylesheet looks like this:

h3.css-bugfix {
	color: hotpink;
}

My child stylesheet looks like this:

h3.css-bugfix {
	color: yellow;
}

When I view the block (tested in both the editor and frontend), I see the child template / stylesheet, as expected:
Screen Shot 2019-07-22 at 7 21 16 pm

In develop I (incorrectly) see the parent template / stylesheet:
Screen Shot 2019-07-22 at 7 21 38 pm

@lukecarbis lukecarbis mentioned this pull request Jul 22, 2019
@kienstra
Copy link
Collaborator

Approved

Hi @lukecarbis,
This looks good.

Like you commented, I also saw that the child theme's blocks are now prioritized over the parent theme's blocks:

child-theme-parent-theme

@lukecarbis lukecarbis merged commit 926ab72 into develop Jul 23, 2019
@lukecarbis lukecarbis deleted the bugfix/334-child-theme-css branch July 23, 2019 03:38
lukecarbis added a commit to lukecarbis/block-lab that referenced this pull request Aug 18, 2019
…theme-css

Load child theme templates before parent theme
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Child theme block CSS isn't loaded when there's a block CSS file in the parent
2 participants