Title: Testing and Feedback for using block based template parts in classic themes
Author: annezazu
Published: September 12, 2022
Last modified: September 14, 2022

---

 [  ](https://profiles.wordpress.org/annezazu/) [annezazu](https://profiles.wordpress.org/annezazu/)
11:39 pm _on_ September 12, 2022     
Tags: [Testing ( 2 )](https://make.wordpress.org/themes/tags/testing/)

# Testing and Feedback for using block based template parts in classic themes

_This post was a collaboration between [@greenshady](https://profiles.wordpress.org/greenshady/)
[@mamaduka](https://profiles.wordpress.org/mamaduka/) [@fabiankaegy](https://profiles.wordpress.org/fabiankaegy/)
[@annezazu](https://profiles.wordpress.org/annezazu/). _

GutenbergGutenberg The Gutenberg project is the new Editor Interface for WordPress.
The editor improves the process and experience of creating new content, making writing
rich content much simpler. It uses ‘blocks’ to add richness rather than shortcodes,
custom HTML etc. [https://wordpress.org/gutenberg/](https://wordpress.org/gutenberg/)
14.1, coming September 15th, enables the ability to use blockBlock Block is the 
abstract term used to describe units of markup that, composed together, form the
content or layout of a webpage using the WordPress editor. The idea combines concepts
of what in the past may have achieved with shortcodes, custom HTML, and embed discovery
into a single consistent API and user experience. template parts without adopting
everything that comes with block templates. Using this functionality, you can do
things like allow a user to edit and build a headerHeader The header of your site
is typically the first thing people will experience. The masthead or header art 
located across the top of your page is part of the look and feel of your website.
It can influence a visitor’s opinion about your content and you/ your organization’s
brand. It may also look different on different screen sizes. with blocks without
exposing them to the entire block template system. This offers a new gradual adoption
pathway for folks with classic or hybrid themes and new ways to explore full site
editing features for agencies that need testing and feedback ahead of WordPress 
6.1’s release on November 1st.

For more information around larger gradual adoption pathways, please review the 
[converting a classic theme to a block theme handbook page](https://developer.wordpress.org/themes/block-themes/converting-a-classic-theme-to-a-block-theme/).
For information around how to curate the experience further while still allowing
new abilities to edit template parts, please review the [curating the editor experience handbook page](https://developer.wordpress.org/block-editor/how-to-guides/curating-the-editor-experience/).

## Overview

Gradual adoption options remains a focus for the project and, increasingly, there
are more ways to adopt parts rather than the whole of a feature coming to the latest
version of WordPress. The aim is to allow folks to adopt what they need as they 
are ready in a way that is still future forward. In this case, once the feature 
is enabled, users will see a new “Template Parts” menu visible under “Appearance,”
which displays a list of template parts. From there, all theme blocks are available,
but the environment is inherently limited compared to block themes. For example,
users can edit existing template parts but not delete them or create new ones.

[⌊WP Admin interface with the Appearance menu open highlighting the new template
parts section.⌉⌊WP Admin interface with the Appearance menu open highlighting the
new template parts section.⌉[

For a sense of how one could adopt this feature, here are a few examples to get 
creativity flowing:

 * Offering a header template part that allows a user to set a video or image background,
   set duotone colors, change the focal point, and more without altering the positioning
   of the blocks within (navigation, site title, etc).
 * Providing the ability to edit parts of a footer directly, like location and hours
   of operations, while keeping the structural blocks locked down to preserve the
   design.
 * Adding a more open ended header template part that allows for any and all block
   movement/removal/etc but curates the experience with certain design tools disabled
   for certain blocks and offering default colors that match the broader theme style.

## How to test

In order to enable this feature a theme first needs to specify block-template-parts
theme support and to use Gutenberg trunk or Gutenberg 14.1 when it’s released on
September 15th, 2022. You can also follow [these instructions](https://make.wordpress.org/design/2021/03/03/testing-a-gutenberg-pull-request-pr/)
to use the [specific PR](https://github.com/WordPress/gutenberg/pull/42729) that
implemented this feature.

With that theme support added a theme can now add block-based template parts by 
placing htmlHTML HTML is an acronym for Hyper Text Markup Language. It is a markup
language that is used in the development of web pages and websites. files containing
the block template into the parts directory inside the root of the theme.

    ```wp-block-code
    function add_block_template_part_support() {
        add_theme_support( 'block-template-parts' );
    }

    add_action( 'after_setup_theme', 'add_block_template_part_support' );
    ```

These block-based template parts can now be used in the traditional PHPPHP PHP (
recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source 
general-purpose scripting language that is especially suited for web development
and can be embedded into HTML. [https://www.php.net/manual/en/index.php](https://www.php.net/manual/en/index.php)
templates by using the block_template_part function. This function returns the markup
of the template part which then needs to get output.

If a theme author wanted to make the site footer available to edit as a template
part, they would create a footer.html file and place it within their theme’s /parts
folder.  The following code snippet is an example of what the template part would
look like:

    ```wp-block-code
    <!-- wp:group {"layout":{"inherit":true}} -->
    <div class="wp-block-group">
    	<!-- wp:group {"style":{"spacing":{"padding":{"top":"80px","bottom":"30px"}}}} -->
    	<div class="wp-block-group" style="padding-top:80px;padding-bottom:30px">
    		<!-- wp:paragraph {"align":"center"} -->
    		<p class="has-text-align-center">Proudly Powered by <a href="https://wordpress.org" rel="nofollow">WordPress</a></p>
    		<!-- /wp:paragraph -->
    	</div>
    	<!-- /wp:group -->
    </div>
    <!-- /wp:group -->
    ```

To display the part on the front end, the theme would include it in its top-level
templates, such as index.php, single.php, and others via the block_template_part()
function with a reference to the part name.  In the case of a site footer, this 
code would replace the call to get_footer() in most themes.

    ```wp-block-code
    <?php block_template_part( 'footer' ); ?>
    ```

**Advanced testing**

While this feature is currently aimed at providing options for themes, plugins can
also explore extending this functionality to enable the same UIUI UI is an acronym
for User Interface - the layout of the page the user interacts with. Think ‘how 
are they doing that’ and less about what they are doing. for users. If you explore
extending this feature via a pluginPlugin A plugin is a piece of software containing
a group of functions that can be added to a WordPress website. They can extend functionality
or add new features to your WordPress websites. WordPress plugins are written in
the PHP programming language and integrate seamlessly with WordPress. These can 
be free in the WordPress.org Plugin Directory [https://wordpress.org/plugins/](https://wordpress.org/plugins/)
or can be cost-based plugin from a third-party., please share what blockers, bugs,
and enhancements you’d like to see to help shape future work in this area.

## Leave your feedback in the comments 

The following are some questions to keep in mind and answer:

 * Did the Template Parts menu appear under Appearance? 
 * Were you able to properly define a template part and see it appear under Appearance
   > Template Parts?
 * When you edited a template part, did the changes properly reflect on the front
   end of the site? 
 * Are there missing features or options that would improve this experience as a
   developer?
 * What did you find frustrating or confusing about the feature?
 * Are there things you particularly appreciated about it?

Please share any and all feedback in the comments.

[#testing](https://make.wordpress.org/themes/tags/testing/)

### Share this:

 * [  Threads ](https://make.wordpress.org/themes/2022/09/12/testing-and-feedback-for-using-block-based-template-parts-in-classic-themes/?share=threads)
 * [  Mastodon ](https://make.wordpress.org/themes/2022/09/12/testing-and-feedback-for-using-block-based-template-parts-in-classic-themes/?share=mastodon)
 * [  Bluesky ](https://make.wordpress.org/themes/2022/09/12/testing-and-feedback-for-using-block-based-template-parts-in-classic-themes/?share=bluesky)
 * [  Facebook ](https://make.wordpress.org/themes/2022/09/12/testing-and-feedback-for-using-block-based-template-parts-in-classic-themes/?share=facebook)
 * [  X ](https://make.wordpress.org/themes/2022/09/12/testing-and-feedback-for-using-block-based-template-parts-in-classic-themes/?share=x)
 * [  LinkedIn ](https://make.wordpress.org/themes/2022/09/12/testing-and-feedback-for-using-block-based-template-parts-in-classic-themes/?share=linkedin)

 * [Login to Reply](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fmake.wordpress.org%2Fthemes%2F2022%2F09%2F12%2Ftesting-and-feedback-for-using-block-based-template-parts-in-classic-themes%2F%23respond&locale=en_US)

 1.  ![](https://secure.gravatar.com/avatar/4f50dc56c80eceb636a7ef7d036a019a7d4189e8b3f87d9c899e848248ef36d8?
     s=32&d=mm&r=g)
 2.   [annezazu](https://profiles.wordpress.org/annezazu/)  11:39 pm _on_ September
     12, 2022
 3.  +make.wordpress.org/test/
 4.  ![](https://secure.gravatar.com/avatar/a8a3c44a68937ee1996ba1bd3325126c4fd962f20b60acc16988dea6b527d14c?
     s=32&d=mm&r=g)
 5.   [Jonathan Bossenger](https://profiles.wordpress.org/psykro/)  9:31 am _on_ September
     14, 2022
 6.  What a cool feature. I just had to test it out.
 7.  Set up a clean WordPress 6.0.2 install, with GutenbergGutenberg The Gutenberg 
     project is the new Editor Interface for WordPress. The editor improves the process
     and experience of creating new content, making writing rich content much simpler.
     It uses ‘blocks’ to add richness rather than shortcodes, custom HTML etc.
      [https://wordpress.org/gutenberg/](https://wordpress.org/gutenberg/)
     trunk installed, and the Twenty Twenty theme.
 8.  Added the example footer template from the post above, and registered it as described
     in the functions.php file.
 9.  I was able to include the footer in my index.php template file, and it rendered
     as expected. However, I did not get the Template Parts menu under Appearance, 
     so I could not answer the rest of the questions. Happy to see if there’s something
     I’ve missed in the setup.
 10. I also have a question regarding pluginPlugin A plugin is a piece of software 
     containing a group of functions that can be added to a WordPress website. They
     can extend functionality or add new features to your WordPress websites. WordPress
     plugins are written in the PHP programming language and integrate seamlessly with
     WordPress. These can be free in the WordPress.org Plugin Directory [https://wordpress.org/plugins/](https://wordpress.org/plugins/)
     or can be cost-based plugin from a third-party. implementations. Would the plugin
     developer simply be able to put the footer.htmlHTML HTML is an acronym for Hyper
     Text Markup Language. It is a markup language that is used in the development 
     of web pages and websites. blockBlock Block is the abstract term used to describe
     units of markup that, composed together, form the content or layout of a webpage
     using the WordPress editor. The idea combines concepts of what in the past may
     have achieved with shortcodes, custom HTML, and embed discovery into a single 
     consistent API and user experience. template inside a folder called “templates”
     in the plugin folder? Or does that need to be registered somehow?
 11.  * ![](https://secure.gravatar.com/avatar/7fab7a27d6eb1e11d63e8a5963991d4adacce3ae704dc2fb7f53d97fad88edce?
        s=32&d=mm&r=g)
      *  [George Stephanis](https://profiles.wordpress.org/georgestephanis/)  2:06 
        pm _on_ September 14, 2022
      * My guess would be that it would need to be added via a filterFilter Filters
        are one of the two types of Hooks [https://codex.wordpress.org/Plugin_API/Hooks](https://codex.wordpress.org/Plugin_API/Hooks).
        They provide a way for functions to modify data of other functions. They are
        the counterpart to Actions. Unlike Actions, filters are meant to work in an
        isolated manner, and should never have side effects such as affecting global
        variables and output., but I’m not sure if that’s currently supported?
      * It looks like the current version relies on theme.jsonJSON JSON, or JavaScript
        Object Notation, is a minimal, readable format for structuring data. It is 
        used primarily to transmit data between a server and web application, as an
        alternative to XML. listing it for registration, I think, and there’s at present
        no way for a pluginPlugin A plugin is a piece of software containing a group
        of functions that can be added to a WordPress website. They can extend functionality
        or add new features to your WordPress websites. WordPress plugins are written
        in the PHP programming language and integrate seamlessly with WordPress. These
        can be free in the WordPress.org Plugin Directory [https://wordpress.org/plugins/](https://wordpress.org/plugins/)
        or can be cost-based plugin from a third-party. to filter that data. And presumably
        we shouldn’t be rewriting the current theme’s `theme.json` file to inject it.
        😛
      * It looks like woocommerce blocks is doing a rather complex workaround to inject
        stuff after the fact:
      * [https://github.com/woocommerce/woocommerce-blocks/blob/trunk/src/BlockTemplatesController.php#L224-L243](https://github.com/woocommerce/woocommerce-blocks/blob/trunk/src/BlockTemplatesController.php#L224-L243)
      * but I’d **really really** like to just see a filter added that plugins could
        use to add extra blockBlock Block is the abstract term used to describe units
        of markup that, composed together, form the content or layout of a webpage 
        using the WordPress editor. The idea combines concepts of what in the past 
        may have achieved with shortcodes, custom HTML, and embed discovery into a 
        single consistent API and user experience. templates — and appropriately sourcing
        the origin parameter for what plugin added it.
         - ![](https://secure.gravatar.com/avatar/7fab7a27d6eb1e11d63e8a5963991d4adacce3ae704dc2fb7f53d97fad88edce?
           s=32&d=mm&r=g)
         -  [George Stephanis](https://profiles.wordpress.org/georgestephanis/)  3:
           14 pm _on_ September 14, 2022
         - Like, ideally I’d like to just see a `wp_theme_json_template_parts` filterFilter
           Filters are one of the two types of Hooks [https://codex.wordpress.org/Plugin_API/Hooks](https://codex.wordpress.org/Plugin_API/Hooks).
           They provide a way for functions to modify data of other functions. They
           are the counterpart to Actions. Unlike Actions, filters are meant to work
           in an isolated manner, and should never have side effects such as affecting
           global variables and output. added here:
         - [https://github.com/WordPress/WordPress/blob/c2ff10f1c10ca2e74923700630d20c8b730726f9/wp-includes/class-wp-theme-json.php#L932-L954](https://github.com/WordPress/WordPress/blob/c2ff10f1c10ca2e74923700630d20c8b730726f9/wp-includes/class-wp-theme-json.php#L932-L954)
         - ![](https://secure.gravatar.com/avatar/7fab7a27d6eb1e11d63e8a5963991d4adacce3ae704dc2fb7f53d97fad88edce?
           s=32&d=mm&r=g)
         -  [George Stephanis](https://profiles.wordpress.org/georgestephanis/)  3:
           33 pm _on_ September 14, 2022
         - Ideally this is how I’d like to see this being made possible for plugins:
         -     ```notranslate
               <?php
               /**
                * Register theme support for block-template-parts as per coming Gutenberg 14.1
                *
                * @link https://make.wordpress.org/themes/2022/09/12/testing-and-feedback-for-using-block-based-template-parts-in-classic-themes/
                */
               function g141testing_add_theme_support() {
               	add_theme_support( 'block-template-parts' );
               }
               add_action( 'after_setup_theme', 'g141testing_add_theme_support' );
           
               /**
                * Use a filter to register our template part.
                *
                * NOTE: This ability to filter is hypothetical and doesn't exist yet in core.
                */
               function g141testing_filter_template_parts( $template_parts, $theme_json ) {
               	$template_parts['g141testing'] = array(
               		'title' => __( 'Gutenberg 14.1 Testing' ),
               		'area' => 'header',
               	);
           
               	return $template_parts;
               }
               add_filter( 'wp_theme_json_template_parts', 'g141testing_filter_template_parts', 10, 2 );
           
               /**
                * Add the template part to the front-end of the site on an action.
                */
               function g141testing_body_open_template() {
               	block_template_part( 'g141testing' );
               }
               add_action( 'wp_body_open', 'g141testing_body_open_template' );
               ```
           
      * ![](https://secure.gravatar.com/avatar/4f50dc56c80eceb636a7ef7d036a019a7d4189e8b3f87d9c899e848248ef36d8?
        s=32&d=mm&r=g)
      *  [annezazu](https://profiles.wordpress.org/annezazu/)  4:20 pm _on_ September
        14, 2022
      * > I was able to include the footer in my index.php template file, and it rendered
        > as expected. However, I did not get the Template Parts menu under Appearance,
        > so I could not answer the rest of the questions. Happy to see if there’s 
        > something I’ve missed in the setup.
      * [@georgestephanis](https://profiles.wordpress.org/georgestephanis/) pointed
        out that it should be after_setup_theme not after_theme_setup. Apologies! Updated
        the post. Can you try once more?
         - ![](https://secure.gravatar.com/avatar/a8a3c44a68937ee1996ba1bd3325126c4fd962f20b60acc16988dea6b527d14c?
           s=32&d=mm&r=g)
         -  [Jonathan Bossenger](https://profiles.wordpress.org/psykro/)  11:50 am 
           _on_ September 15, 2022
         - > after_setup_theme
         - Aha, got it. I get caught on that one myself 😁
      * ![](https://secure.gravatar.com/avatar/a8a3c44a68937ee1996ba1bd3325126c4fd962f20b60acc16988dea6b527d14c?
        s=32&d=mm&r=g)
      *  [Jonathan Bossenger](https://profiles.wordpress.org/psykro/)  12:00 pm _on_
        September 15, 2022
      * Update:
      * **Did the Template Parts menu appear under Appearance? ** – Yes
      * **Were you able to properly define a template part and see it appear under 
        Appearance > Template Parts?** – Yes
      * **When you edited a template part, did the changes properly reflect on the 
        front end of the site? 
         
         – Yes
      * **Are there missing features or options that would improve this experience 
        as a developer?
         
         – This is more of a Site Editor comment, but if this is 
        the first time someone is using the site editor, the pathway back to the dashboard
        might be confusing. I’ve always preferred to keep the left-hand side navigation
        showing, so the link to the dashboard is clear.
      * **What did you find frustrating or confusing about the feature?** – I’m not
        sure if this is related to the group blockBlock Block is the abstract term 
        used to describe units of markup that, composed together, form the content 
        or layout of a webpage using the WordPress editor. The idea combines concepts
        of what in the past may have achieved with shortcodes, custom HTML, and embed
        discovery into a single consistent API and user experience. in the example 
        code from this post, but I wanted to be able to edit the padding and margin–
        set via code the template part – in the editor, and I could not. I’m guessing
        this is because these settings are turned off by default, and so I’d probably
        need to enable them via a custom theme.jsonJSON JSON, or JavaScript Object 
        Notation, is a minimal, readable format for structuring data. It is used primarily
        to transmit data between a server and web application, as an alternative to
        XML. in my classic theme. It would be cool if the styles that have been set
        on a per block level in the template part could somehow be enabled in the editor,
        but I’m sure that’s a bunch more work (ie the file would need to be parsed,
        checked for any custom styles, and then those styles enabled)
      * **Are there things you particularly appreciated about it?** I love the fact
        that this exists and makes it easy to register custom template parts in a classic
        theme, that folks can edit. Developers can still build classic themes the old
        way, that their users can’t edit in the editor, except for the template parts
        they specify.
      * ![](https://secure.gravatar.com/avatar/5612a0b1e26e958b7cb153ad8d69325be61525b2bba4819361bb69f127ec34b4?
        s=32&d=mm&r=g)
      *  [mrwweb](https://profiles.wordpress.org/mrwweb/)  4:49 pm _on_ September 15,
        2022
      * This is such an exciting feature, and I hope I’m able to fully test it soon!
      * One thing not mentioned here is that this feature feels like a blockBlock Block
        is the abstract term used to describe units of markup that, composed together,
        form the content or layout of a webpage using the WordPress editor. The idea
        combines concepts of what in the past may have achieved with shortcodes, custom
        HTML, and embed discovery into a single consistent API and user experience.-
        first alternative to Widgets. Although the new Widgets screen does support 
        blocks, I often find it buggy and suboptimal. Having a new block-first way 
        to manage global site regions in hybrid themes is a game changer. I’d encourage
        use case to be called out explicitly when announcing this feature and talking
        about migrating things to use more block-first features.
      * Also, I have a question about this:
      * > this code would replace the call to `get_footer()` in most themes.
      * I do not think this is correct. `get_footer()` includes the `footer.php` file
        which usually includes `wp_footer();`. The `wp_footer()` function is critical
        for loading scripts and supporting the admin bar in themes. So for folks who
        are adding this feature to a “classic” theme, I don’t think this is a replacement
        for `get_footer()`/ `wp_footer()`. Is my understanding correct, or am I missing
        something?
         - ![](https://secure.gravatar.com/avatar/8013a62d7397c006bae48b96d6832a573ea71a7d5d3597fe584210567b508c05?
           s=32&d=mm&r=g)
         -  [Justin Tadlock](https://profiles.wordpress.org/greenshady/)  4:56 pm _on_
           September 15, 2022
         - That is a good thing to point out. It can be a replacement for `get_footer()`,
           but it does not replace the need for classic themes to still call `wp_footer()`
           or the closing `body` and `html` tags.
         - I’ll make a note that we should mention that in any docs (along with `wp_head()`
           and `wp_body_open()`).
            * ![](https://secure.gravatar.com/avatar/2f29f1226af37b331598b018ca34e508b1f09661f3f9192676a845c151873c6a?
              s=32&d=mm&r=g)
            *  [Pauthake015](https://profiles.wordpress.org/pauthake015/)  10:45 pm
              _on_ September 18, 2022
            * It is exiting! Works as advertised.
            * _Did the Template Parts menu appear under Appearance?_ – Yes
               _Were you
              able to properly define a template part and see it appear under Appearance
              > Template Parts?_ – Yes _When you edited a template part, did the changes
              properly reflect on the front end of the site?_ – Yes _Are there missing
              features or options that would improve this experience as a developer?_
               - I was wondering whether `header.html` parts also works, same way! 
                 I still have to do further testing. A question: is there plan to add`/
                 templates` folder as well to add pages.
            *  - ![](https://secure.gravatar.com/avatar/dff685ba0190529bbb5878cfcacb5e67e8ca042cf4492e309fe5d7c43061667a?
                 s=32&d=mm&r=g)
               -  [George Mamadashvili](https://profiles.wordpress.org/mamaduka/)  
                 12:22 pm _on_ October 4, 2022
               - The ability to add/edit page template was introduced in WordPress 
                 5.8 – [https://make.wordpress.org/core/2021/06/16/introducing-the-template-editor-in-wordpress-5-8/](https://make.wordpress.org/core/2021/06/16/introducing-the-template-editor-in-wordpress-5-8/).
 12. ![](https://secure.gravatar.com/avatar/bdcf680acfed62d1709790b679ac9ceed13c7ca100f3de109a90ced4685b2c85?
     s=32&d=mm&r=g)
 13.  [neoqeen232](https://profiles.wordpress.org/neoqeen232/)  8:40 pm _on_ September
     16, 2022
 14. yes, correct, we are missing the ability to enter the site editor in the “focused
     template part” mode directly. We have the building pieces mostly in place, we 
     just need to enable it for classic themes. It should be a good area of work for
     6.0. A classic theme should not need to use full-blockBlock Block is the abstract
     term used to describe units of markup that, composed together, form the content
     or layout of a webpage using the WordPress editor. The idea combines concepts 
     of what in the past may have achieved with shortcodes, custom HTML, and embed 
     discovery into a single consistent API and user experience. templates to benefit
     from block template parts and a UIUI UI is an acronym for User Interface - the
     layout of the page the user interacts with. Think ‘how are they doing that’ and
     less about what they are doing. to manage them. The things to consider are mostly
     around the information architecture and access points.
 15.  * ![](https://secure.gravatar.com/avatar/4f50dc56c80eceb636a7ef7d036a019a7d4189e8b3f87d9c899e848248ef36d8?
        s=32&d=mm&r=g)
      *  [annezazu](https://profiles.wordpress.org/annezazu/)  11:13 pm _on_ October
        26, 2022
      * Thanks for chiming in [@neoqeen232](https://profiles.wordpress.org/neoqeen232/)
        and for your patience in my reply. You might find this guide helpful for gradual
        adoption of site editing features: [https://developer.wordpress.org/themes/block-themes/converting-a-classic-theme-to-a-block-theme/](https://developer.wordpress.org/themes/block-themes/converting-a-classic-theme-to-a-block-theme/)
 16. ![](https://secure.gravatar.com/avatar/1ad51d7556a9b54724939607cbd2e7e752064654c71e4d1dfa547fe8dab754ff?
     s=32&d=mm&r=g)
 17.  [Andrei Baicus](https://profiles.wordpress.org/baicusandrei/)  9:42 am _on_ September
     21, 2022
 18. It’s great to see this coming for classic themes as well!
 19. I think allowing developers to specify which templates should be loaded would 
     be great.
 20. I believe that this extends to blockBlock Block is the abstract term used to describe
     units of markup that, composed together, form the content or layout of a webpage
     using the WordPress editor. The idea combines concepts of what in the past may
     have achieved with shortcodes, custom HTML, and embed discovery into a single 
     consistent API and user experience.-based themes as well. If you want to define
     templates for CPTs (e.g., WooCommerce Single Product), these will be loaded automatically,
     regardless of the pluginPlugin A plugin is a piece of software containing a group
     of functions that can be added to a WordPress website. They can extend functionality
     or add new features to your WordPress websites. WordPress plugins are written 
     in the PHP programming language and integrate seamlessly with WordPress. These
     can be free in the WordPress.org Plugin Directory [https://wordpress.org/plugins/](https://wordpress.org/plugins/)
     or can be cost-based plugin from a third-party.’s state. When it comes to classic
     themes, authors would probably want to allow the user to pick which templates 
     he intends to override with block templates.
 21. A classic theme might implement a complex archive layout with many customization
     features but still want to allow the possibility to use a template for the archive
     based on a customizerCustomizer Tool built into WordPress core that hooks into
     most modern themes. You can use it to preview and modify many of your site’s appearance
     settings. setting.
 22. I’ve seen that WooCommerce has managed to load templates from the plugin in a 
     [custom class](https://github.com/woocommerce/woocommerce-blocks/blob/a5d7c19451e78ef8b2467ddef06e3dc2e0184021/docs/internal-developers/templates/block-template-controller.md),
     but that feels a bit cumbersome. Maybe allowing a second argument with which templates
     to be loaded for both theme supports could be a solution.
 23.  * ![](https://secure.gravatar.com/avatar/4f50dc56c80eceb636a7ef7d036a019a7d4189e8b3f87d9c899e848248ef36d8?
        s=32&d=mm&r=g)
      *  [annezazu](https://profiles.wordpress.org/annezazu/)  11:13 pm _on_ October
        26, 2022
      * [@baicusandrei](https://profiles.wordpress.org/baicusandrei/) that’s a super
        interesting use case! I couldn’t find a similar GitHubGitHub GitHub is a website
        that offers online implementation of git repositories that can easily be shared,
        copied and modified by other developers. Public repositories are free to host,
        private repositories require a paid subscription. GitHub introduced the concept
        of the ‘pull request’ where code changes done in branches by contributors can
        be reviewed and discussed before being merged by the repository owner. [https://github.com/](https://github.com/)
        issue. Do you mind opening one, detailing the use case you have in mind? The
        answer might be doing what WooCommerce is doing but it would be interesting
        to see the discussion nonetheless. If you don’t have time, happy to open it
        for you 🙂
         - ![](https://secure.gravatar.com/avatar/1ad51d7556a9b54724939607cbd2e7e752064654c71e4d1dfa547fe8dab754ff?
           s=32&d=mm&r=g)
         -  [Andrei Baicus](https://profiles.wordpress.org/baicusandrei/)  9:37 am 
           _on_ October 27, 2022
         - Thank you for the reply!
         - I’ve created a GitHubGitHub GitHub is a website that offers online implementation
           of git repositories that can easily be shared, copied and modified by other
           developers. Public repositories are free to host, private repositories require
           a paid subscription. GitHub introduced the concept of the ‘pull request’
           where code changes done in branches by contributors can be reviewed and 
           discussed before being merged by the repository owner. [https://github.com/](https://github.com/)
           issue in the GutenbergGutenberg The Gutenberg project is the new Editor 
           Interface for WordPress. The editor improves the process and experience 
           of creating new content, making writing rich content much simpler. It uses‘
           blocks’ to add richness rather than shortcodes, custom HTML etc.
            [https://wordpress.org/gutenberg/](https://wordpress.org/gutenberg/)
           repository: [https://github.com/WordPress/gutenberg/issues/45341](https://github.com/WordPress/gutenberg/issues/45341)
            * ![](https://secure.gravatar.com/avatar/4f50dc56c80eceb636a7ef7d036a019a7d4189e8b3f87d9c899e848248ef36d8?
              s=32&d=mm&r=g)
            *  [annezazu](https://profiles.wordpress.org/annezazu/)  4:52 pm _on_ October
              27, 2022
            * Thank you so much! Labeled and tagged some folks in. I’ll also highlight
              it for the FSEFSE Short for Full Site Editing, a project for the Gutenberg
              plugin and the editor where a full page layout is created using only 
              blocks. Outreach Program next week where many blockBlock Block is the
              abstract term used to describe units of markup that, composed together,
              form the content or layout of a webpage using the WordPress editor. The
              idea combines concepts of what in the past may have achieved with shortcodes,
              custom HTML, and embed discovery into a single consistent API and user
              experience. themers hang out.
 24. ![](https://secure.gravatar.com/avatar/dc83ba67c09e990784dcdd6654375beb2f324ed6d36b514f57c25c67632d4890?
     s=32&d=mm&r=g)
 25.  [plaidpowered](https://profiles.wordpress.org/plaidpowered/)  5:22 pm _on_ September
     29, 2022
 26. Firstly, this is such a great feature add, thank you! I was messing around with
     some classic theme code during WordCampWordCamp WordCamps are casual, locally-
     organized conferences covering everything related to WordPress. They're one of
     the places where the WordPress community comes together to teach one another what
     they’ve learned throughout the year and share the joy. [Learn more](https://central.wordcamp.org/about/).
     and was silently wishing that I could mix blockBlock Block is the abstract term
     used to describe units of markup that, composed together, form the content or 
     layout of a webpage using the WordPress editor. The idea combines concepts of 
     what in the past may have achieved with shortcodes, custom HTML, and embed discovery
     into a single consistent API and user experience. templates in with my PHPPHP 
     PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open 
     source general-purpose scripting language that is especially suited for web development
     and can be embedded into HTML. [https://www.php.net/manual/en/index.php](https://www.php.net/manual/en/index.php)…
     and a few days later this happened! I’m so excited.
 27. Working with this right now, I have run into an issue I can’t find the answer 
     to in documentation. How do I properly attach a stylesheet to the template editor?
     The file I’ve enqueued with “enqueue_block_editor_assets” is not being registered
     or enqueued inside the editor iframeiframe iFrame is an acronym for an inline 
     frame. An iFrame is used inside a webpage to load another HTML document and render
     it. This HTML document may also contain JavaScript and/or CSS which is loaded 
     at the time when iframe tag is parsed by the user’s browser..
 28. So, feedback:
      _Did the Template Parts menu appear under Appearance?  – **Yes**
 29. _Were you able to properly define a template part and see it appear under Appearance
     > Template Parts?_ – **Yes**
 30. _When you edited a template part, did the changes properly reflect on the front
     end of the site? _ – **Yes**
 31. _Are there missing features or options that would improve this experience as a
     developer?_
 32. **I would love the ability to specify a maximum container size that would constrain
     the width of the part editor. This would be useful for more accurate previews 
     of template parts like sidebars. Of course, this probably could be done with a
     stylesheet as well if there were some indicators in the editor’s DOM that could
     tell a stylesheet which template part was being edited.**
 33. _What did you find frustrating or confusing about the feature?_
 34. **For some time I couldn’t figure out how to scroll inside the template part editor.
     It could be this was fixed in 14.1.1**
 35. _Are there things you particularly appreciated about it?_
 36. **It’s a straight-forward UIUI UI is an acronym for User Interface - the layout
     of the page the user interacts with. Think ‘how are they doing that’ and less 
     about what they are doing. that I don’t think anyone would be uncomfortable working
     in, if they are already familiar with the block editor. Everything works exactly
     how I expected it to. I personally feel like this should replace the experience
     for widgetWidget A WordPress Widget is a small block that performs a specific 
     function. You can add these widgets in sidebars also known as widget-ready areas
     on your web page. WordPress widgets were originally created to provide a simple
     and easy-to-use way of giving design and structure control of the WordPress theme
     to the user. management, which is still seems incredibly buggy in WP 6.0. This
     is so much more stable and easy to use, and effectively is going to replace every
     part of my templates that were using widgets.**
 37.  * ![](https://secure.gravatar.com/avatar/dff685ba0190529bbb5878cfcacb5e67e8ca042cf4492e309fe5d7c43061667a?
        s=32&d=mm&r=g)
      *  [George Mamadashvili](https://profiles.wordpress.org/mamaduka/)  12:16 pm 
        _on_ October 4, 2022
      * Thank you for the feedback, [@plaidpowered](https://profiles.wordpress.org/plaidpowered/)!
      * **How do I properly attach a stylesheet to the template editor?**
      * Personally, I would recommend using [editor styles](https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#enqueuing-the-editor-style)
        for theme-related CSS.
      * > I would love the ability to specify a maximum container size that would constrain
        > the width of the part editor.
      * You can achieve this by sprinkling some “theme.json” settings. Justin showcased
        this very well in his recent tutorial -https://gutenbergtimes.com/building-
        a-block-based-header-template-in-a-classic-theme/#2-adding-theme-json-support
         - ![](https://secure.gravatar.com/avatar/dc83ba67c09e990784dcdd6654375beb2f324ed6d36b514f57c25c67632d4890?
           s=32&d=mm&r=g)
         -  [plaidpowered](https://profiles.wordpress.org/plaidpowered/)  12:29 pm 
           _on_ October 4, 2022
         - Thanks! I appreciate the reply. Unfortunately the editor styles aren’t enqueuing
           for me in the template part editor, I’m using `add_editor_style`, I’ve tried
           using it from the `enqueue_block_editor_assets` action, `init`, and immediately
           in functions.php. My stylesheet does get attached to the parent page that
           wraps the template part editor iframeiframe iFrame is an acronym for an 
           inline frame. An iFrame is used inside a webpage to load another HTML document
           and render it. This HTML document may also contain JavaScript and/or CSS
           which is loaded at the time when iframe tag is parsed by the user’s browser.,
           but not inside the iframe. But if it’s working for others, I could be doing
           something wrong still. The trick will be to figure out what my problem is…
           😝
            * ![](https://secure.gravatar.com/avatar/dff685ba0190529bbb5878cfcacb5e67e8ca042cf4492e309fe5d7c43061667a?
              s=32&d=mm&r=g)
            *  [George Mamadashvili](https://profiles.wordpress.org/mamaduka/)  1:54
              pm _on_ October 4, 2022
            * Have you enabled editor styles via `add_theme_support( 'editor-styles');`?
            * When building the feature, I primarily used the “Twenty Twenty One” child
              themeChild theme A Child Theme is a customized theme based upon a Parent
              Theme. It’s considered best practice to create a child theme if you want
              to modify the CSS of your theme. [https://developer.wordpress.org/themes/advanced-topics/child-themes/](https://developer.wordpress.org/themes/advanced-topics/child-themes/),
              and editor styles were loading for me correctly. Here’s how the coreCore
              Core is the set of software required to run WordPress. The Core Development
              Team builds WordPress. theme enables support for it – [https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-content/themes/twentytwentyone/functions.php#L126-L143](https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-content/themes/twentytwentyone/functions.php#L126-L143).
               - ![](https://secure.gravatar.com/avatar/dc83ba67c09e990784dcdd6654375beb2f324ed6d36b514f57c25c67632d4890?
                 s=32&d=mm&r=g)
               -  [plaidpowered](https://profiles.wordpress.org/plaidpowered/)  3:37
                 pm _on_ October 4, 2022
               - Yep, I was doing that. Xdebugging a bit showed me that the css file
                 was indeed being added to the editor’s inline styles, but what I didn’t
                 realize was that add_editor_style re-scopes the CSSCSS CSS is an acronym
                 for cascading style sheets. This is what controls the design or look
                 and feel of a site. for GutenbergGutenberg The Gutenberg project is
                 the new Editor Interface for WordPress. The editor improves the process
                 and experience of creating new content, making writing rich content
                 much simpler. It uses ‘blocks’ to add richness rather than shortcodes,
                 custom HTML etc.
                  [https://wordpress.org/gutenberg/](https://wordpress.org/gutenberg/).
                 Everything gets wrapped in `.editor-styles-wrapper`, [per this comment.](https://developer.wordpress.org/reference/functions/add_editor_style/#comment-5332)
               - This caused a problem for my stylesheet, because I was already scoping
                 the rules myself – so essentially they got double scoped by the time
                 the CSS reached the blockBlock Block is the abstract term used to 
                 describe units of markup that, composed together, form the content
                 or layout of a webpage using the WordPress editor. The idea combines
                 concepts of what in the past may have achieved with shortcodes, custom
                 HTML, and embed discovery into a single consistent API and user experience.
                 editor, and none of the rules applied. It wasn’t a problem on the 
                 post block editor because I was using `wp_enqueue_style` instead of`
                 add_editor_style` prior to this conversation. (Hence why I was scoping
                 the editor rules in the first place.)
               - Thanks for your help with this! It is much appreciated.
 38. ![](https://secure.gravatar.com/avatar/608a55ba828e696df43650257be7b55a15259dd6765d7cd9c527d092bdd2fbb9?
     s=32&d=mm&r=g)
 39.  [Mauro](https://profiles.wordpress.org/maurodf/)  12:27 pm _on_ October 22, 2022
 40. Awesome idea, thanks for developing that.
      I tested with one of my custom theme
     and all worked fine, but i have some questions.
 41. This footer is created for replace the wp_footer(). I enqueued some js files into
     the footer, how can i do with this new feature?
      Second one, there a way to create
     a little structure that if any user (or myself) completes the footer design the
     theme renders the htmlHTML HTML is an acronym for Hyper Text Markup Language. 
     It is a markup language that is used in the development of web pages and websites.
     structure, but if the html file is empty, the theme renders the php file?
 42. Thank u and again, awesome work!
 43. ![](https://secure.gravatar.com/avatar/608a55ba828e696df43650257be7b55a15259dd6765d7cd9c527d092bdd2fbb9?
     s=32&d=mm&r=g)
 44.  [Mauro](https://profiles.wordpress.org/maurodf/)  8:54 am _on_ October 24, 2022
 45. Hi, thanks for developed this awesome feature!
 46. My results:
 47. Did the Template Parts menu appear under Appearance? – Yes
 48. Were you able to properly define a template part and see it appear under Appearance
     > Template Parts? – yes, all fine. Added also header.htmlHTML HTML is an acronym
     for Hyper Text Markup Language. It is a markup language that is used in the development
     of web pages and websites. and it appears.
 49. When you edited a template part, did the changes properly reflect on the front
     end of the site? – All the changes appear without problems.
 50. Are there missing features or options that would improve this experience as a 
     developer? – I’d like to add some specificity. So, if i write a footer.php in 
     my classic theme this will be rendered as default. But if client (or my self) 
     edit the html file (via FSEFSE Short for Full Site Editing, a project for the 
     Gutenberg plugin and the editor where a full page layout is created using only
     blocks. or code) and save, this will be rendered. There’s a way to achive this?
 51. What did you find frustrating or confusing about the feature? No one at the moment.
     Little thing, but more about the FSE and my little experience with it.
 52. Are there things you particularly appreciated about it? – The possibility to continue
     to create classic theme but also give the client the possibility to use the FSE
     for some part of the site.
 53.  * ![](https://secure.gravatar.com/avatar/4f50dc56c80eceb636a7ef7d036a019a7d4189e8b3f87d9c899e848248ef36d8?
        s=32&d=mm&r=g)
      *  [annezazu](https://profiles.wordpress.org/annezazu/)  5:33 pm _on_ October
        27, 2022
      * Thanks so much for testing this and apologies for missing the original comment.
        It was held in moderation and I missed it!
      * > So, if i write a footer.php in my classic theme this will be rendered as 
        > default. But if client (or my self) edit the htmlHTML HTML is an acronym 
        > for Hyper Text Markup Language. It is a markup language that is used in the
        > development of web pages and websites. file (via FSEFSE Short for Full Site
        > Editing, a project for the Gutenberg plugin and the editor where a full page
        > layout is created using only blocks. or code) and save, this will be rendered.
        > There’s a way to achive this?
      * What are you trying to archive exactly? Can you share a bit more context?
      * > This footer is created for replace the wp_footer(). I enqueued some js files
        > into the footer, how can i do with this new feature?
      * [@mamaduka](https://profiles.wordpress.org/mamaduka/) could you perhaps answer
        this? It’s beyond my abilities.
      * > Second one, there a way to create a little structure that if any user (or
        > myself) completes the footer design the theme renders the html structure,
        > but if the html file is empty, the theme renders the php file?
      * Right now, I don’t think there’s a way to do this. To be clear, when you create
        a template part for this, the HTML file will have content in place. Whatever
        you put in place for PHPPHP PHP (recursive acronym for PHP: Hypertext Preprocessor)
        is a widely-used open source general-purpose scripting language that is especially
        suited for web development and can be embedded into HTML. [https://www.php.net/manual/en/index.php](https://www.php.net/manual/en/index.php),
        you can just have in the template part! Does that track with what you’re asking
        about?
         - ![](https://secure.gravatar.com/avatar/608a55ba828e696df43650257be7b55a15259dd6765d7cd9c527d092bdd2fbb9?
           s=32&d=mm&r=g)
         -  [Mauro](https://profiles.wordpress.org/maurodf/)  9:27 pm _on_ October 
           27, 2022
         - > Thanks so much for testing this and apologies for missing the original
           > comment. It was held in moderation and I missed it!
         - don’t be sorry at all, it was my mistake to public a second comment, my 
           bad.
         - > What are you trying to archive exactly? Can you share a bit more context?
         - My second comment explain it more clarity, and u already responded to me.
         - > Right now, I don’t think there’s a way to do this. To be clear, when you
           > create a template part for this, the HTMLHTML HTML is an acronym for Hyper
           > Text Markup Language. It is a markup language that is used in the development
           > of web pages and websites. file will have content in place. Whatever you
           > put in place for PHPPHP PHP (recursive acronym for PHP: Hypertext Preprocessor)
           > is a widely-used open source general-purpose scripting language that is
           > especially suited for web development and can be embedded into HTML. [https://www.php.net/manual/en/index.php](https://www.php.net/manual/en/index.php),
           > you can just have in the template part! Does that track with what you’re
           > asking about?
         - Not exactly, sorry for explaining it wrong, i’m not the best in english,
           sorry.
         - What i means is: this feature is awesome and bring some news to classic 
           theme.
            But i think that would be great if there’s a way to “switch” between
           for example footer.html or footer.php
         - Example:
         - I’m building a classic php theme, and add this feature in my theme adding
           the support to template parts.
         - Now, when i upload my theme into the reposity and someone install on his
           wordpress installtion he can choose between the footer.php i have already
           coded and the FSEFSE Short for Full Site Editing, a project for the Gutenberg
           plugin and the editor where a full page layout is created using only blocks.
           footer.html that he can design. (maybe this can be done via code, with an
           if
         - “If footer.html exist etc…”
         - or can be done with a select, like already work on the template page (user
           u can create another page template and choosing between them).
         - Hope this is more clear.
            Again, sorry for my english.
         - > I would recommend still using footer.php or a similar template for the
           > wp_footer() method. Then you can use blockBlock Block is the abstract 
           > term used to describe units of markup that, composed together, form the
           > content or layout of a webpage using the WordPress editor. The idea combines
           > concepts of what in the past may have achieved with shortcodes, custom
           > HTML, and embed discovery into a single consistent API and user experience.
           > templates to render actual markup/content. Here’s an example: [https://github.com/Mamaduka/block-fragments/blob/main/footer.php](https://github.com/Mamaduka/block-fragments/blob/main/footer.php)
         - Ok fine, is exactly what i did in my test mode, perfect. Thank u!
      * ![](https://secure.gravatar.com/avatar/dff685ba0190529bbb5878cfcacb5e67e8ca042cf4492e309fe5d7c43061667a?
        s=32&d=mm&r=g)
      *  [George Mamadashvili](https://profiles.wordpress.org/mamaduka/)  6:08 pm _on_
        October 27, 2022
      * > This footer is created for replace the wp_footer(). I enqueued some js files
        > into the footer, how can i do with this new feature?
      * I would recommend still using `footer.php` or a similar template for the `wp_footer()`
        method. Then you can use blockBlock Block is the abstract term used to describe
        units of markup that, composed together, form the content or layout of a webpage
        using the WordPress editor. The idea combines concepts of what in the past 
        may have achieved with shortcodes, custom HTML, and embed discovery into a 
        single consistent API and user experience. templates to render actual markup/
        content. Here’s an example: [https://github.com/Mamaduka/block-fragments/blob/main/footer.php](https://github.com/Mamaduka/block-fragments/blob/main/footer.php)
         - ![](https://secure.gravatar.com/avatar/608a55ba828e696df43650257be7b55a15259dd6765d7cd9c527d092bdd2fbb9?
           s=32&d=mm&r=g)
         -  [Mauro](https://profiles.wordpress.org/maurodf/)  9:28 pm _on_ October 
           27, 2022
         - > I would recommend still using footer.php or a similar template for the
           > wp_footer() method. Then you can use blockBlock Block is the abstract 
           > term used to describe units of markup that, composed together, form the
           > content or layout of a webpage using the WordPress editor. The idea combines
           > concepts of what in the past may have achieved with shortcodes, custom
           > HTML, and embed discovery into a single consistent API and user experience.
           > templates to render actual markup/content. Here’s an example: [https://github.com/Mamaduka/block-fragments/blob/main/footer.php](https://github.com/Mamaduka/block-fragments/blob/main/footer.php)
         - Ok fine, is exactly what i did in my test mode, perfect. Thank u!

### Leave a Reply 󠀁[Cancel reply](https://make.wordpress.org/themes/2022/09/12/testing-and-feedback-for-using-block-based-template-parts-in-classic-themes/?output_format=md#respond)󠁿

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fmake.wordpress.org%2Fthemes%2F2022%2F09%2F12%2Ftesting-and-feedback-for-using-block-based-template-parts-in-classic-themes%2F&locale=en_US)
to post a comment.

This site uses Akismet to reduce spam. [Learn how your comment data is processed.](https://akismet.com/privacy/)

# Post navigation

[← Themes team meeting agenda for September 13, 2022](https://make.wordpress.org/themes/2022/09/12/themes-team-meeting-agenda-for-september-13-2022/)

[Themes team meeting agenda for September 27, 2022 →](https://make.wordpress.org/themes/2022/09/26/themes-team-meeting-agenda-for-september-27-2022/)