內容簡介
在 WordPress 中,每個頁面必須有意地分配一個模板(或是有一個特定的模板文件名稱),否則 WordPress 會使用預設的 page.php 模板。子頁面不會繼承父頁面的模板。在擁有層次結構的多子頁面的大型網站中,這不是一種易於使用或無錯誤的方式,用來使用頁面模板以創建分段式內容管理系統。用戶可以將模板分配給頂層頁面(或「節點開始」頁面),但其後代(子頁面)不會跟隨祖先的模板。每個頁面的模板必須逐個分配。對於少量頁面和用戶的小型網站來說,這並不是一個顯著的問題。但對於擁有數百或數千頁面,多位編輯和多個「節點」的網站來說,WordPress 作為一個內容管理系統平台,並不理想。
該插件解決了這個問題。它調查每個頁面並為頁面及其子頁面分配層次模板,優先使用 page-[id].php 模板。如果整個祖略樹中沒有找到 page-[id].php 模板,那麼它將返回祖先樹中的 page-[slug].php 模板。如果這些都找不到,則它將尋找經元指派的 custom.php 模板-首先為當前選定的頁面,如果該頁面沒有分配 custom.php 模板,則函數將回溯祖先濶列以查看是否已經分配了祖先頁面的 custom.php 模板。如果所有這些都失敗,它將回退到 WP 的預設 page.php 模板。
更多說明請參閱 http://www.warkensoft.net/wordpress-plugins/wordpress-hierarchical-page-template-redirect-plugin/ 。
外掛標籤
開發者團隊
② 後台搜尋「Hierarchical Page Template Redirect」→ 直接安裝(推薦)
原文外掛簡介
In WordPress each page must be intentionally assigned a template (or have a template file intentionally named for it) or WordPress applies the default page.php template. Child pages do not inherit parent page templates. On a large website with many child pages within a hierarchy of pages this does not make for an easy or error free way to use page templates to create a sectioned CMS. A user can assign a template to a top level page (or a “beginning of section” page) but its descendants (child pages) will not follow with their ancestor’s template. Each page’s template must be individually assigned. For small sites with few pages and few users this is not a significant matter. On a site with hundreds or thousands of pages and multiple editors and multiple “sections” this makes WordPress less than ideal as a CMS platform
This plugin solves that problem. It investigates each page and assigns hierarchical templates to pages and their children giving precedence to page-[id].php templates. If no page-[id].php templates are found all the way up the ancestory tree then it will check for page-[slug].php templates back up the ancestory tree. If those are not found then it will look for a meta assigned custom.php template – first for the currently selected page and then if the page does not have a custom.php template assigned the function will look back up the ancestory tree to see if an ancestor page has been assigned a custom.php template. If all of these fail it will fall back to WP’s default page.php template.
There is more description at http://www.warkensoft.net/wordpress-plugins/wordpress-hierarchical-page-template-redirect-plugin/
