{"id":175308,"date":"2023-06-07T21:34:06","date_gmt":"2023-06-07T21:34:06","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/network-template-parts\/"},"modified":"2024-11-06T05:37:39","modified_gmt":"2024-11-06T05:37:39","slug":"network-template-parts","status":"publish","type":"plugin","link":"https:\/\/dzo.wordpress.org\/plugins\/network-template-parts\/","author":15605205,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.0.4","stable_tag":"1.0.4","tested":"6.7.5","requires":"6.3","requires_php":"7.4","requires_plugins":null,"header_name":"Network Template Parts","header_author":"Happy Prime","header_description":"Render template parts in a site or network context.","assets_banners_color":"3f4382","last_updated":"2024-11-06 05:37:39","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/github.com\/happyprime\/network-template-parts\/","header_author_uri":"https:\/\/happyprime.co","rating":0,"author_block_rating":0,"active_installs":10,"downloads":1165,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","changelog"],"tags":{"1.0.1":{"tag":"1.0.1","author":"happyprime","date":"2023-06-07 21:33:27"},"1.0.2":{"tag":"1.0.2","author":"happyprime","date":"2023-07-12 21:12:28"},"1.0.3":{"tag":"1.0.3","author":"happyprime","date":"2023-07-12 21:19:18"},"1.0.4":{"tag":"1.0.4","author":"happyprime","date":"2024-11-06 05:37:39"}},"upgrade_notice":[],"ratings":[],"assets_icons":{"icon-128x128.jpeg":{"filename":"icon-128x128.jpeg","revision":2946328,"resolution":"128x128","location":"assets","locale":""},"icon-256x256.jpeg":{"filename":"icon-256x256.jpeg","revision":2946328,"resolution":"256x256","location":"assets","locale":""}},"assets_banners":{"banner-1544x500.jpeg":{"filename":"banner-1544x500.jpeg","revision":2946328,"resolution":"1544x500","location":"assets","locale":""},"banner-772x250.jpeg":{"filename":"banner-772x250.jpeg","revision":2946328,"resolution":"772x250","location":"assets","locale":""}},"assets_blueprints":{},"all_blocks":{"ntp\/network-template-part":{"$schema":"https:\/\/json.schemastore.org\/block.json","apiVersion":2,"name":"ntp\/network-template-part","title":"Network Template Part","category":"widgets","icon":"location","description":"Render a template part in the context of a site or network.","version":"0.0.1","textdomain":"network-template-parts","editorScript":"file:index.js","attributes":{"slug":{"type":"string","default":""},"context":{"type":"string","default":"site"}}}},"tagged_versions":["1.0.1","1.0.2","1.0.3","1.0.4"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[441,139732,4516],"plugin_category":[43,51],"plugin_contributors":[208741,80671,209288,209287],"plugin_business_model":[],"class_list":["post-175308","plugin","type-plugin","status-publish","hentry","plugin_tags-multisite","plugin_tags-site-editor","plugin_tags-templates","plugin_category-customization","plugin_category-multisite","plugin_contributors-happyprime","plugin_contributors-jeremyfelt","plugin_contributors-philcable","plugin_contributors-slocker","plugin_committers-happyprime","plugin_committers-jeremyfelt"],"banners":{"banner":"https:\/\/ps.w.org\/network-template-parts\/assets\/banner-772x250.jpeg?rev=2946328","banner_2x":"https:\/\/ps.w.org\/network-template-parts\/assets\/banner-1544x500.jpeg?rev=2946328","banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/network-template-parts\/assets\/icon-128x128.jpeg?rev=2946328","icon_2x":"https:\/\/ps.w.org\/network-template-parts\/assets\/icon-256x256.jpeg?rev=2946328","generated":false},"screenshots":[],"raw_content":"<!--section=description-->\n<p>When managing a brand across many sites, it is often necessary to ship changes to the look and feel with the certainty that they will be applied immediately.<\/p>\n\n<p>In its current iteration, the WordPress site editor allows individual site administrators to make changes to a theme's templates and template parts. Once a template or a template part has been edited on an individual site, it no longer receives updates from the theme automatically, which may in turn cause unintended consequences.<\/p>\n\n<p>This plugin provides a way for site administrators to edit parts of the site without accidentally overwriting pieces that should remain consistent.<\/p>\n\n<p>Network Template Parts works in tandem with <a href=\"https:\/\/github.com\/happyprime\/restrict-network-templates\">Restrict Network Templates<\/a>, which restricts the editing of templates on individual sites.<\/p>\n\n<h3>Assumptions<\/h3>\n\n<h3>Templates provided by the theme should not be edited.<\/h3>\n\n<p>A theme's core structure is defined by templates. (e.g. <code>templates\/home.html<\/code>)<\/p>\n\n<p>It should be possible to set a structure in these templates and assume that they will not be overridden on individual sites.<\/p>\n\n<h3>Network-level template parts are managed by network administrators.<\/h3>\n\n<p>Parts of a theme's structure rely on data from the main site on a network. (e.g. global navigation)<\/p>\n\n<p>It should be possible for a template to specify that a section of a page is rendered in the context of the main site.<\/p>\n\n<h3>Site-level template parts are managed by site administrators.<\/h3>\n\n<p>Parts of a theme's structure rely on data from individual sites on a network. (e.g. site navigation, content)<\/p>\n\n<p>It should be possible to override site-level template parts from an individual site.<\/p>\n\n<h3>Block<\/h3>\n\n<p>The Network Template Part block renders a selected template part in either a \"site\" or \"network\" context.<\/p>\n\n<p>Attributes:<\/p>\n\n<ul>\n<li><code>slug<\/code> determines which template part to load. Template parts are located in a theme's <code>parts\/<\/code> directory.<\/li>\n<li><code>context<\/code> determines the context in which the part should render.<\/li>\n<\/ul>\n\n<h3>Examples<\/h3>\n\n<p>Often, a network will provide common header and footer areas while leaving the site content between to site administrators. With Network Template Parts, this can be accomplished as so:<\/p>\n\n<p>A <code>templates\/index.html<\/code> file may contain:<\/p>\n\n<pre><code>&lt;!-- wp:ntp\/network-template-part {\"slug\":\"header\",\"context\":\"network\"} \/--&gt;\n&lt;!-- wp:ntp\/network-template-part {\"slug\":\"main-index\",\"context\":\"site\"} \/--&gt;\n&lt;!-- wp:ntp\/network-template-part {\"slug\":\"footer\",\"context\":\"network\"} \/--&gt;\n<\/code><\/pre>\n\n<p>&gt;<\/p>\n\n<p>This loads <code>parts\/header.html<\/code> from the main site on the network, <code>parts\/main-index.html<\/code> from the current site, and <code>parts\/footer.html<\/code> from the main site on the network.<\/p>\n\n<p>The <code>parts\/header.html<\/code> file main contain:<\/p>\n\n<pre><code>&lt;!-- wp:ntp\/network-template-part {\"slug\":\"header-top\",\"context\":\"network\"} \/--&gt;\n&lt;!-- wp:ntp\/network-template-part {\"slug\":\"header-main\",\"context\":\"network\"} \/--&gt;\n<\/code><\/pre>\n\n<p>&gt;<\/p>\n\n<p>This defines two areas in the header to be managed at the network level. The <code>parts\/header-main.html<\/code> may contain something like:<\/p>\n\n<pre><code>&lt;!-- wp:group --&gt;\n&lt;div class=\"wp-block-group\"&gt;\n    &lt;!-- wp:group {\"tagName\":\"header\"} --&gt;\n    &lt;header class=\"wp-block-group\"&gt;\n        &lt;!-- wp:ntp\/network-template-part {\"slug\":\"header-main-network-logo\",\"context\":\"network\"} \/--&gt;\n        &lt;!-- wp:ntp\/network-template-part {\"slug\":\"header-main-site-navigation\",\"context\":\"site\"} \/--&gt;\n    &lt;\/header&gt;\n    &lt;!-- \/wp:group --&gt;\n&lt;\/div&gt;\n&lt;!-- \/wp:group --&gt;\n<\/code><\/pre>\n\n<p>&gt;<\/p>\n\n<p>This provides some common HTML structure, loads a network-level logo, and also provides a site-level navigation in <code>parts\/header-main-site-navigation.html<\/code>.<\/p>\n\n<p>Now, an individual site administrator can make changes to a navigation menu while also receiving updates from the theme and the network if the look and feel of the broader network changes.<\/p>\n\n<!--section=changelog-->\n<h3>1.0.4<\/h3>\n\n<ul>\n<li>Confirm WordPress 6.6 compatibility.<\/li>\n<li>Raise minimum supported WordPress to 6.3.<\/li>\n<li>Update <code>block.json<\/code> API version to 3.<\/li>\n<li>Improve build tooling, coding standards.<\/li>\n<li>No functional changes.<\/li>\n<\/ul>\n\n<h3>1.0.3<\/h3>\n\n<ul>\n<li>Adjust deployment scripting.<\/li>\n<\/ul>\n\n<h3>1.0.2<\/h3>\n\n<ul>\n<li>Update <code>@wordpress\/scripts<\/code> dependency to 26.8.0.<\/li>\n<li>Include built files so that the block actually works.<\/li>\n<\/ul>\n\n<h3>1.0.1<\/h3>\n\n<ul>\n<li>Update <code>@wordpress\/scripts<\/code> dependency to 26.6.0.<\/li>\n<li>Add POT file.<\/li>\n<li>Initial wp.org release.<\/li>\n<\/ul>\n\n<h3>1.0.0<\/h3>\n\n<ul>\n<li>Consolidate into one block: Network Template Part.<\/li>\n<li>Add \"context\" attribute.<\/li>\n<\/ul>\n\n<h3>0.1.1<\/h3>\n\n<ul>\n<li>Provide a select interface for site and network template parts.<\/li>\n<li>Improve plugin documentation.<\/li>\n<li>Update <code>@wordpress\/scripts<\/code> dependency to 26.3.0.<\/li>\n<\/ul>\n\n<h3>0.1.0<\/h3>\n\n<p>Initial release<\/p>","raw_excerpt":"Render template parts in a site or network context.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/dzo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/175308","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dzo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/dzo.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/dzo.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=175308"}],"author":[{"embeddable":true,"href":"https:\/\/dzo.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/happyprime"}],"wp:attachment":[{"href":"https:\/\/dzo.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=175308"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/dzo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=175308"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/dzo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=175308"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/dzo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=175308"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/dzo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=175308"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/dzo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=175308"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}