What it does

On a multisite network, the site editor lets each site’s administrators change the theme’s templates and template parts. The moment they change one, that site stops receiving the theme’s updates to it. Update the network’s header, and the sites that touched theirs keep the old one.

Network Template Parts gives a template a way to say which parts are the network’s and which are the site’s. A part rendered in the network context always comes from the main site, so a change there reaches every site at once. A part rendered in the site context comes from the current site, and its administrators can edit it without losing anything from the network.

How it works

It is one block, for use in a theme’s template files rather than in content. The block names a template part and a context. A theme’s templates/index.html might be:

<!-- wp:ntp/network-template-part {"slug":"header","context":"network"} /-->
<!-- wp:ntp/network-template-part {"slug":"main-index","context":"site"} /-->
<!-- wp:ntp/network-template-part {"slug":"footer","context":"network"} /-->Code language: HTML, XML (xml)

The header and footer come from the main site. The middle comes from whichever site is being viewed. Parts nest, so a network header can itself hold a network logo and a site navigation:

<!-- wp:ntp/network-template-part {"slug":"header-logo","context":"network"} /-->
<!-- wp:ntp/network-template-part {"slug":"header-navigation","context":"site"} /-->Code language: HTML, XML (xml)

Each site then manages its own menu, and still receives every change the network makes to the header around it.

Good for

  • A university or a government, where central IT owns the header, footer, and required links, and departments own their pages and menus.
  • A company with many locations, where the brand owns the frame and each location owns its hours and staff.
  • An agency running a network of client sites on one theme.

What to know

  • It needs a multisite network and a block theme, and a developer to put the block in the theme’s templates.
  • It governs structure, not content. Headers, footers, and sidebars. It does not copy posts or pages between sites.
  • Pair it with Restrict Network Templates, which stops individual sites from editing the theme’s templates at all. Together, the network defines the frame and each site edits only the parts it was given.

One header for the whole network.

Questions about Network Template Parts for your network?

Interested in contributing to Network Template Parts?

Tell us what you’re working on