WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.51k stars 4.2k forks source link

adding templateParts to child theme disables random titles of other template parts #39166

Open 9-tailed opened 2 years ago

9-tailed commented 2 years ago

Description

The 2022 theme has 4 template parts. I wanted to add 1 with a child theme, a second footer. This worked as intended, but it had a little side-effect. After I added a new template part, one of the parent templates parts lost its title, instead, it showed the slug/name. After adding a second template part another parent template part lost its title but the first one got its back.

Step-by-step reproduction instructions

  1. Create a Child theme of 2022 theme
  2. add a custom template part to the theme.json
    "templateParts": [  
        {
            "name": "footer-landing",
            "title": "Footer (Landing Page)",
            "area": "footer"
        }

"Header" now losts its title and is shown as "header" in the editor.

  1. add another template part to the theme.json
    "templateParts": [  
        {
            "name": "header",
            "title": "Header",
            "area": "header"
        },
        {
            "name": "footer-landing",
            "title": "Footer (Landing Page)",
            "area": "footer"
        }

"Header" is back to "Header", "Header (Dark, large)" is now shown as "header-large-dark"

Screenshots, screen recording, code snippet

grafik

Environment info

WP: Version 5.9.1 Gutenberg: Version 12.6.1 Theme: Twenty Twenty Two Child 1.1

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

chthonic-ds commented 2 years ago

Just noting I've seen similar behaviour when adding templates to a theme, no child required. I didn't have time to troubleshoot at the time but will see if I can replicate when I get a free moment.

Mamaduka commented 2 years ago

I think templateParts of a child and parent theme aren't correctly merged.