{"id":15124095,"date":"2022-01-05T22:50:52","date_gmt":"2022-01-05T22:50:52","guid":{"rendered":"https:\/\/wordpress.org\/support\/?post_type=helphub_article&p=15124095"},"modified":"2024-09-23T08:32:19","modified_gmt":"2024-09-23T08:32:19","slug":"template-part-block","status":"publish","type":"helphub_article","link":"https:\/\/wordpress.org\/documentation\/article\/template-part-block\/","title":{"rendered":"Template Part block"},"content":{"rendered":"\n

Go back to the list of Blocks<\/strong><\/a><\/p>\n\n\n\n

The Template Part block<\/em> is an advanced block introduced in WordPress 5.9 that can be used with a block theme or a theme that supports template editing<\/a>. They often come with your theme and are used to organize and display your site structure. You can only use them while creating and editing templates to manage blocks in areas repeated across the website. For context, this block is best used to create areas like your site header and site footer. When you change blocks inside a template part, the editor updates the blocks on every block template that includes the template part.<\/p>\n\n\n\n

In order to add a Template Part block<\/em>, click on the add block button and select the Template Part block<\/em>. You can also type \u201c\/template part\u201d<\/em> and hit enter in a new paragraph block to add one quickly. In many cases, you’ll also see options to select types of Template Part blocks, like Header and Footer when searching for this block. You can search for the header or footer in the block inserter to insert the blocks or use the shortcuts “\/header”<\/em> and “\/footer”.<\/em><\/p>\n\n\n\n

Detailed instructions on adding blocks can be found here<\/a>.<\/em><\/p>\n\n\n\n

Adding template parts<\/h2>\n\n\n\n

You can add templates when using the Template Editor<\/a> or Site Editor<\/a> to edit templates directly. After adding a template part, you can choose from existing parts or create a new template part:<\/p>\n\n\n\n

\"Template<\/figure>\n\n\n\n

Choosing from existing template parts<\/h3>\n\n\n\n

Selecting the button “Choose” opens a modal where you can search, preview, and select existing parts. These parts will depend on what your theme has provided:<\/p>\n\n\n\n

\"Using<\/figure>\n\n\n\n

Creating new template parts<\/h3>\n\n\n\n

Selecting “Start blank” will prompt you to add a name. It’s best to pick a descriptive name so that it’s easy to find in the future:<\/p>\n\n\n\n

\"When
Click on the “start blank” button to place the block and begin customizing. <\/figcaption><\/figure>\n\n\n\n

<\/p>\n\n\n\n

Creating new template parts from the template part list<\/h3>\n\n\n\n

If you are using a block theme, you can also create a new template part from the template part list in Administration Screen > Appearance > Editor > Patterns > Template Parts. Click on the Create patterns icon to find Create template part:<\/p>\n\n\n\n

\"Template
Creating template part from Patterns area<\/figcaption><\/figure>\n\n\n\n

When you select the Create template part, a modal appears where you can add a name and select the area for the template part. You must provide a name in order to create a new template part:<\/p>\n\n\n\n

\"Upon<\/figure>\n\n\n\n

Importing widget area<\/h3>\n\n\n\n

If you’ve switched from a classic theme to a block theme and widgets created in the classic theme, you can import them from Import Widget Area dropdown in the Advanced Settings. Select the widget from dropdown and click Import.<\/p>\n\n\n\n

\"Import
Screenshot<\/figcaption><\/figure>\n\n\n\n

Managing template parts and patterns<\/h3>\n\n\n\n

At the bottom of the patterns screen, there is an option to manage all template parts. From you can create new template parts, or rename, delete and reset customizations made to the template parts.<\/p>\n\n\n\n

\"At<\/figure>\n\n\n\n

Customizing template parts<\/h2>\n\n\n\n

After adding or selecting a Template Part block<\/em>, you can customize in various ways by adding additional blocks within it. To make it easier to find current template parts to edit, it’s recommended that you use one of the following options:<\/p>\n\n\n\n