How to Create a Template Part in WordPress Block Editor

The Template Part block is an essential tool in the WordPress block editor that allows users to create and display a consistent section of their website on multiple pages. This feature is particularly useful for repeated elements across the website, such as headers, footers, sidebars, comments, and post meta. Users can also create custom Template Parts that can be reused throughout their website’s layout, providing a seamless design experience. However, it’s important to note that this feature is only compatible with themes supporting template editing, so users should verify their chosen theme is compatible before using this feature.

In the WordPress block editor using Site Editor, Template Parts such as Header, Footer, Comment, Post Meta, and Sidebar are blocks that allow users to create consistent and reusable sections of their website.

  • The Header Template Part block is typically located at the top of the website. Usually, it contains the site logo, navigation menu, and other essential elements that should be displayed on all website pages.
  • The Footer Template Part block is usually located at the bottom of the website. It includes copyright notices, links to social media accounts, and other relevant information that should be displayed on all website pages.
  • The Comment Template Part block displays information such as the author’s name, publication date, and any comments left by visitors to the website.
  • The Post Meta Template Part block displays additional information about a blog post, such as the publication date, author’s name, category, and tags.
  • The Sidebar Template Part block is often used to display information such as recent posts, categories, tags, and other widgets relevant to the page’s content.

Using Template Parts in the WordPress block editor allows users to create a consistent look and feel throughout their website and save time by not having to recreate the same elements on multiple pages.

Tip

It’s important to remember that the specific options may vary based on the version of WordPress, theme, and plugin you are using.

1

Open the Full Site Editor and navigate to the “Template Parts” section.

2

In the sidebar, you can see a list of template parts available for the theme. If you want to add new ones, click the “Add New” button in the sidebar’s top right corner.

3

A new window will appear when you click on it, showing a list of a few template parts areas you can create.

4

We’ll be creating a General template part for this tutorial. By default, the General option is already selected. You must type in a name for your template part and click the Create button.

5

After opening the template part, the screen will display a blank space with the name of your template part at the center and top of the interface. To begin building your template part, click on the “+” symbol in the top left corner.

6

You can choose from various blocks or patterns to create your template section. The Pricing Pattern shown in the screenshot below is an example of one such pattern. It includes a columns block with three columns.

7

To save your progress, click the Save button in the screen’s upper right-hand corner.

8

You have now finished creating your template section. Viewing the list of template sections, you will notice that the section you just created has been added.

💌

Unlock Exclusive Perks: Join Our VIP Subscriber Club Today!

Subscribe for special promotions, offers, freebies, and the latest updates and news – all exclusively for our VIPs. Don’t miss out, join now! 🌟💌🎁

We won’t send you spam, we promise.

Comments

3 responses

  1. Kevin Avatar

    Hi

    I still have no idea why you need templates. You show the part that you built which I can understand, after this I have no idea of what use this template is. I have tried building them and then failed to see how they work. They cause so much confusion to me. Do you have a video on this?

    1. Munir Kamal Avatar
      Munir Kamal

      Hi Kevin,

      The Template Part is a helpful tool in the WordPress block editor. It allows you to create a section of your website, such as a header or footer, and use it on many pages. For instance, on our website, we have the “Newsletter section,” which is also added via site editor and appears on all blog posts at GutenbergHub. Does this make sense now? Additionally, for more information about template parts, check out the official documentation at:

      https://wordpress.org/documentation/article/template-part-block/

      Hope this helps.

      1. Kevin Avatar
        Kevin

        Nope, not one bit. Where is your newsletter section on here then?

        I just cannot getmy hea around what they do. Any of them. I have tried adding content to them, and then looked for them and cannot see them anywhere.

        Mind boggling

Leave a Reply

Your email address will not be published. Required fields are marked *

Join the All Access Club

Your All-Inclusive Pass to Premium WordPress Products.