• Resolved abitofmind

    (@abitofmind)


    Reproduction

    1. Using TT3 as my theme.
    2. Customized template “Page”.
      Main content area:
      Removed the blocks “Post Title” and “Post Comments”.
      “Post Content” block the only remaining one.
    3. Also created custom templates “page-title-none” and “page-original-minimally-modified”. Not used anywhere. But important to confirm the bug in your plugin.
    4. Customized template part “Header”
      • Group (with ?? Inner blocks use content width)
      • Row (Justification: Space between Items)
      • Site Logo , Shortcode block with [maxmegamenu location=max_mega_menu_1] which renders my classical menu in a block theme.
    5. WordPress → Appearance → Create child theme → Filled all the fields → Generated child theme “tt3dd”.
    6. WordPress → Appearance → Themes → Activated child theme “tt3dd” as my active theme.

    Unexpected outcome:

    • In the Site Editor it looked like the customized parent theme had looked.
    • But in the frontend I had no header and footer!

    Troubleshooting: Found nothing online. Inspected all created files:

    wp-content/themes/tt3dd/
      parts/
        header.html
      templates/ 
        page.html
        wp-custom-template-page-title-none.html
        wp-custom-template-page-original-minimally-modified.html

    Cause:

    • The bug happens in all templates/*.html files.
    • The plugin had left references to the parent theme "theme":"twentytwentythree" all over!
    • During child theme creation it should have replaced all the references to the slug of the child-theme which is "theme":"tt3dd".
    • ?</img> After I did that manually, header and footer again appeared in the frontend!

    Probably also another bug in the Gutenberg Site Editor / Frontend

    After that I also realized why the child theme still had shown correctly in the Site Editor: It still used the parent theme’s page template and header template part which had my customization overrides still in the database!

    But when rendering in the frontend it seems to use only the child-theme and not the user customizations of the parent theme, but the user customizations of the child theme (which are NULL in the database then).

    This behavioral difference of Site Editor and Frontend is probably a bug of its own, which I will report to the Gutenberg team, and cross link the two reports.

Viewing 10 replies - 1 through 10 (of 10 total)
  • I have the same issue that @abitofmind, and also I can’t upload any font to the childtheme. The Manage Fonts section is blank.

    Thread Starter abitofmind

    (@abitofmind)

    Flavia, thanks for confirming! I hope that we will get a reaction.

    I created a child theme of the free block theme available in WordPress ‘VisualBlogger’ but when activating the child theme it is missing the header or footer sections that parent theme shows when reactivated.

    Thread Starter abitofmind

    (@abitofmind)

    @dubaidogfish this sounds very much to be the bug that I reported. Make sure to change the references as I described it. In your wp-content/themes/visualblogger/templates/*.html files change all outdated references like "theme":"visualblogger" to "theme":"visualblogger-childtheme" (or whatever slug (=machine readable unique name) you used for your child theme).

    • This reply was modified 1 year, 7 months ago by abitofmind.
    Plugin Author Matias Benedetto

    (@mmaattiiaass)

    Hi ??! Thanks for reporting this.
    There is a potential fix proposed for this issue. It would be very useful if you can try the fix and report again if it’s working as expected or not.

    You can download the zip with the potential fix here.

    Disclaimer: as this change is not tested and released yet, please, don’t use it on production sites. This is only suitable for test environments.

    Thread Starter abitofmind

    (@abitofmind)

    @mmaattiiaass Tested successfully and left full test report.

    @ fellow other WP users: Looks good! With that fix the plugin will do it correctly. And until then you have to replace the false "theme" : "parenttheme" references manually with the correct "theme" : "parenttheme-child" references.

    Plugin Author Matias Benedetto

    (@mmaattiiaass)

    Thanks @abitofmind for testing! The fix will be released soon in a new version of the plugin.

    I had the same issue. I tried renaming every single template, template part and pattern to begin with “z”, thinking that would make WordPress use only the parent templates and parts. The header and footer were still missing! It didn’t seem to matter whether I used the fix or not or renamed the references to point to the parent or child theme or simply removed the theme reference entirely in the home.html template. The only way I got the header to show was by inserting it (again) using the site editor. At that point, the original header still showed in the site editor – but not on the front end – and the newly inserted header from the same template part showed both inside the site editor and on the front end.

    To be sure I knew if the header was coming from child or parent theme, I edited the code directly (not through the site editor) and added the words “child theme” at the end. Those words then appeared on the front end.

    I am thinking that something in the database is controlling this. When I use the site editor to insert the template part, that adds a user setting to the database, does it not?

    I want to add to what I said yesterday. I think my original frustrations were because I had tried editing the site when it wasn’t showing the header and footer, before I tried changing the aforementioned references from “twentytwentythree” to “twentytwentythreechild” in all the child templates.

    Today on my test site, I deleted both the parent and child themes and then cloned the entire production site (including the database) into the test site again (using the plugin, All-in-One WP Migration). I created a new child theme with Create Block Theme. Before activating the child theme, I replaced “twentytwentythree” with “twentytwentythreechild” in every single child template and template part created by Create Block Theme. THEN I activated the theme for the first time. Worked perfectly. Header and footer showed on the front end. Yay!

    To be absolutely sure, I inserted a paragraph directly into the header template, echoed some words in child theme’s patterns/header.php file, and inserted a paragraph into the parts/comments.html template which was otherwise completely empty. All of these showed on the front end, so I know the child theme is correctly displaying its own templates.

    Plugin Author Matias Benedetto

    (@mmaattiiaass)

    The fix for the original issue described by @abitofmind was released as part of the 1.8.1 version of the plugin. I’m marking this as solved. Feel free to create new threads if you found other problems with this!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Creating child-theme forgets to replace parent-theme references in /templates’ is closed to new replies.