What is a template part and how is it different from reusable blocks and block patterns?

In this post we will see the difference between these three elements:

  • Template parts. It is an advanced block that can be used with a block theme or a hybrid theme that supports template editing. The parts of the template are associated with the structure of the site and not with the content. You can create template parts by inserting reusable blocks and block patterns but not the other way around. If something repeats on your site related to its structure, like a footer, sidebar, or header, use the template parts block. This block is synchronized. This means that if it is modified in one place, it is updated everywhere that template part is used. Template parts are FSE specific (as of WordPress 5.9) but can be used with a classic theme that has the ability to edit templates (hybrid theme) [see WordPress Theme Types and How to Add Full Edit Features from the site to the classical themes]. More info: official page.
  • reusable blocks. A reusable block is also synchronized but is content-oriented. If you want to repeat content in various parts of your website, you can use a reusable block. In a reusable block you cannot insert a template part but vice versa. If you change the content of a reusable block, all instances of the reusable block are updated wherever they are inserted. This comes in handy, for example, for content that you want to repeat in all blog posts. For example, the social network buttons at the bottom of the post. More info: official page.
  • Block Patterns. Block patterns are predefined layouts that you will customize with your own content. Do not sync. Therefore, use block patterns in those places where static content will exist. You can add block patterns to template parts but not the other way around. And reusable blocks can be turned into block patterns. Themes often come with block patterns to use and customize. More info: official page.

To learn more about templates and template parts, go to our Full Site Editing course and watch a hands-on exercise on How to Add Templates and Template Parts to the Miniblock OOAK Theme.