Converting a classic theme to a block theme
While you can find many benefits, there are a few potential issues to consider when converting a classic theme to a block theme.
- Converting a classic theme may affect child themes. Consider the potential impacts before converting.
- theme.json requires WordPress version 5.8 or later. Consequently, the support for Internet Explorer 11 was dropped when WordPress 5.8 was released. If your classic theme supports IE11, converting to a block theme potentially impacts the theme’s appearance.
There are several ways to slowly adopt the Full Site Editing features on a classic theme.
A universal theme is a block theme that has the Customizer options. The Customizer is not available as a default on a block theme, but you can enable it by adding
customize_register on functions.php. Learn more about customize_register.
A hybrid theme is a classic theme that adopts the Full Site Editing features such as theme.json or template editor. For example, you can enable color pallets or set default content width by simply adding theme.json on your classic theme.
Note: Adding a theme.json enables global styles, but it does not enable the styles interface.
theme.json manages global styles and also per block. In addition, it consolidates all
add_theme_support. When using theme.json, there is no need to call add_theme_support in functions.php. theme.json can be added to classic themes by creating theme.json in the root directory. Note that theme.json requires WordPress version 5.8 or later. Learn more about theme.json.
Block patterns are preset layouts that are made up of blocks. They can be inserted anywhere on a site, including the header and footer. For example, when a classic theme offers users a choice to add a sidebar, traditionally a theme provides a one-column layout or a two-column layout via the Customizer. Block patterns can offer the same options using block markup. Learn more about how to add block patterns.
There are several ways to enable the template editor:
- Adding theme.json
add_theme_support( 'block-templates' );
To use theme.json without the template editor, theme authors can opt-out of this feature by removing the
block-templates theme support:
remove_theme_support( 'block-templates' );
Creating a templates directory and adding an index.html inside it enables the template editor in the post editor, and the Site Editor under the Appearance menu in the admin area. However, this results in hiding the Customizer menu.
Note: You can restore the Customizer by adding customize_register. This method is considered as a Universal theme or Hybrid theme. The universal theme works with Customizer and the Site Editor.
- State of the Customizer with block themes in WordPress 5.9
- Block-styles loading enhancements in WordPress 5.8
- Should we update or retire existing themes?
- Sharing Approaches for FSE Feature Adoption
- What Happens to the Customizer When a Block Theme Is Active?
- Updated 2022-02-15 Added information about how to remove the block template theme support.
- Created 2022-01-20