
內容簡介
此外掛可以讓您在 WordPress 的自訂文章類型中加入自訂文章範本。您可以像套用頁面範本一樣,輕鬆地在自訂文章類型文章中套用自訂文章範本。
這些範本的定義方式與頁面範本相似,如果選擇此範本,就會取代指定文章的single-cpt-slug.php (參見模板階層https://developer.wordpress.org/themes/basics/template-hierarchy/ )。
管理員可以輕鬆地透過點擊預設設定按鈕,使用此自訂文章類型外掛的預設設定。
實現注意事項:
頁面範本在檔案的頂端使用「模板名稱:」註解,而要使用此外掛的自訂文章範本,請使用「WP文章範本:my-post-type-slug」- 您可以通過將適用的註解添加到 PHP 檔案中,結合頁面範本和自訂文章類型範本。
自訂文章類型範本使用「WP文章類型:」加上自訂的文章類型別名,例如「WP文章類型:my-fun-post-type」,您可以將一個範本用於多種文章類型-如果留空,則將可用於所有文章類型,這將保持 WP 自訂文章範本 1.0 的相容性。
必須將自訂文章範本檔案存儲在與 index.php 範本文件相同的目錄/文件夾中,而不是在子目錄/子文件夾中。
功能
選擇需要顯示文章範本的自訂文章類型。
選擇使用預設設定,在您的佈景主題預設的文章類型中顯示文章範本。
您可以根據所選的自訂文章範本添加進階自訂欄位。
外掛標籤
開發者團隊
② 後台搜尋「WP Custom Post Template Redux」→ 直接安裝(推薦)
原文外掛簡介
This plugin lets you add the custom post templates in your WordPress custom post type. You can easily apply your custom post template in custom post type posts, just as you would do the same for page templates.
The templates are defined similarly to page templates, and if selected will replace single-cpt-slug.php (see template hierarchy https://developer.wordpress.org/themes/basics/template-hierarchy/) for the specified post.
Admin can use default setting for the custom post type plugin by simply clicking on default setting button.
Implementation notes:
Page templates use, in the comments at the top of the file “Template Name:”, whereas to use this plugin’s custom post templates use “WP Post Template: my-post-type-slug” — you can combine page templates and custom post type templates by just adding the applicable comments to the PHP file.
CPT templates use “WP Post Type:” plus the custom post type slug, e.g. “WP Post Type: my-fun-post-type” you can use a single template for multiple post types – if you leave it blank it will be available to all post types, which will maintain compatibility with WP Custom Post Template 1.0.
You must have store the custom post template files in your theme in the same directory/folder as your index.php template file, not in a sub-directory/sub-folder.
Features
Select custom post type where you need to show the post template.
Select default setting to show post template in your theme default post type.
You can add Advanced Custom Fields field groups based on the Custom Post Template chosen
