
內容簡介
總結: WordPress 網站繁多時,跨網站管理品牌外觀變更是必須的,但更改單一網站的模板或模板部分后,會使其不再受主題自動更新,從而造成意想不到的後果。此外掛提供了一種方法,使網站管理員可以在不意外覆蓋應保持一致的區塊的情況下編輯網站部分。Network Template Parts 與 Restrict Network Templates 一起使用,可以限制單一網站的模板編輯。 問題與答案: Q: 當管理跨多個網站的品牌時,以確定變更會立即應用是什麼? A: 當管理跨多個網站的品牌時,以確定變更會立即應用是必須的。 Q: WordPress 現在的網站編輯器允許哪些人更改主題模板和模板部分? A: WordPress 網站目前的編輯器允許各個網站的管理員更改主題的模板和模板部分。 Q: 如果在單個網站上編輯模板或模板部分,會發生什麼情況? A: 如果在單個網站上編輯模板或模板部分,它將不再自動從主題接收更新,這可能會導致意想不到的後果。 Q: Network Template Parts 與 Restrict Network Templates 一起使用可以做什麼? A: Network Template Parts 與 Restrict Network Templates 一起使用,可以限制單一網站的模板編輯。 Q: Network Template Parts 是用來做什麼的? A: Network Template Parts 用於編輯網站部分,而不會意外覆蓋需要保持一致的部分。 Q: Network Template Parts 和 Restrict Network Templates 需要一起使用嗎? A: 是的,Network Template Parts 需要和 Restrict Network Templates 一起使用。 Q: Network Template Part block 是什麼? A: Network Template Part block 可以在“網站”或“網路”上下文中渲染所選的模板部分。 Q: Network Template Part block 有哪些屬性? A: 網絡模板部分塊有兩個屬性,slug 確定要加載哪個模板部分,而 context 確定應在哪個上下文中呈現它。 Q: Network Template Parts 可以如何達到使用網絡級標題和頁腳區域,同時保留網站內容供網站管理員編輯的目的? A: 使用 Network Template Parts,可以通過像以下這樣的方式實現:templates/index.html 文件中包含<!-- 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"} /-->。這會從網絡的主站載入 parts/header.html,從當前站點載入 parts/main-index.html,並從網絡的主站載入 parts/footer.html。其中 parts/header.html 文件的 header-top 定義網絡級別的類別,而header-main 文件中,可以在其中定義一些公共的 HTML 結構。進而在 header-main 網頁上增加 site-level navigation in parts/header-main-site-navigation.html,讓單一網站的管理員可以在不影響主題和網絡視覺設計的前提下進行導覽菜單的調整。
外掛標籤
開發者團隊
原文外掛簡介
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. 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. This plugin provides a way for site administrators to edit parts of the site without accidentally overwriting pieces that should remain consistent. Network Template Parts works in tandem with Restrict Network Templates, which restricts the editing of templates on individual sites. Assumptions Templates provided by the theme should not be edited. A theme’s core structure is defined by templates. (e.g. templates/home.html) It should be possible to set a structure in these templates and assume that they will not be overridden on individual sites. Network-level template parts are managed by network administrators. Parts of a theme’s structure rely on data from the main site on a network. (e.g. global navigation) It should be possible for a template to specify that a section of a page is rendered in the context of the main site. Site-level template parts are managed by site administrators. Parts of a theme’s structure rely on data from individual sites on a network. (e.g. site navigation, content) It should be possible to override site-level template parts from an individual site. Block The Network Template Part block renders a selected template part in either a “site” or “network” context. Attributes: slug determines which template part to load. Template parts are located in a theme’s parts/ directory. context determines the context in which the part should render. Examples 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: A templates/index.html file may contain: > This loads parts/header.html from the main site on the network, parts/main-index.html from the current site, and parts/footer.html from the main site on the network. The parts/header.html file main contain: > This defines two areas in the header to be managed at the network level. The parts/header-main.html may contain something like:
