# Dynamically loading template parts in block themes

DevFeed: [Dynamically loading template parts in block themes](<https://devfeed.tech/articles/dynamically-loading-template-parts-in-block-themes-44838.md>)

Original publisher: [Read original article](<https://developer.wordpress.org/news/2026/06/dynamically-loading-template-parts-in-block-themes/>)

Author: Justin Tadlock

Published: 2026-06-18T21:28:46Z

Content type: tutorial

Language: en

Sources: [WordPress](<https://devfeed.tech/sources/wordpress-developer-blog.md>)

Topics: [WordPress](<https://devfeed.tech/topics/wordpress.md>), [render](<https://devfeed.tech/topics/render.md>), [implementation](<https://devfeed.tech/topics/implementation.md>)

Tags: [block-themes](<https://devfeed.tech/tags/block-themes.md>), [conditional](<https://devfeed.tech/tags/conditional.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [render](<https://devfeed.tech/tags/render.md>), [template-parts](<https://devfeed.tech/tags/template-parts.md>), [themes](<https://devfeed.tech/tags/themes.md>), [wordpress](<https://devfeed.tech/tags/wordpress.md>)

## AI overview

A tutorial explains how WordPress block theme authors can use the render_block_data filter to dynamically select template parts based on post category, page context, or other conditional logic, avoiding duplicate top-level templates.

## Source excerpt

Stop duplicating WordPress block theme templates just to load different sidebar content. Learn how to use the render_block_data filter to dynamically swap template parts based on post category, page context, or any conditional logic -- no extra templates required.