Making WordPress.org

Opened 5 months ago

Closed 5 months ago

Last modified 5 months ago

#8079 closed defect (bug) (fixed)

Theme preview: block themes: parent theme global styles missing in child theme preview

Reported by: andrewstarr's profile andrewstarr Owned by: dd32's profile dd32
Milestone: Priority: high
Component: Theme Directory Keywords:
Cc:

Description

If a child theme does not duplicate all styles & settings of its parent theme in the child theme's theme.json, the parent styles are not loaded in the preview.

Duplicating all parent global styles is not needed for the child theme to function correctly in a normal WordPress site, but in the theme preview it seems this is necessary. Is this a bug or is it intentional?

Example:
https://wordpress.org/themes/skincare-brand/preview/
https://wp-themes.com/skincare-brand/

Change History (5)

#1 @dd32
5 months ago

Is this a bug or is it intentional?

Definitely a bug. It should behave the same as if the theme was installed / activated on a site as normal.

The problem is likely that the Theme Activation steps aren't actually run in the preview, which is somehow causing the styles not to load. This might be something to do with the fact that it's not running within an admin context.

#2 @andrewstarr
5 months ago

Thanks for the information.

I'll add that other aspects of child theming such as templating seem to be working correctly. In the example the front-page template is fetched from the child theme, and the page template is from the parent theme as expected.

#3 @dd32
5 months ago

  • Owner set to dd32
  • Status changed from new to accepted

#4 @dd32
5 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 14522:

Theme Preview: Fix the theme preview for FSE child themes.

See https://core.trac.wordpress.org/ticket/57141
See https://github.com/wordpress/gutenberg/issues/45811
Fixes #8079

#5 @andrewstarr
5 months ago

@dd32 Thanks for pointing me to those open issues.

I can confirm that a quick fix is to add an empty index.php file to the child theme.

Note: See TracTickets for help on using tickets.