
內容簡介
自訂文章類型多路由外掛可讓您管理、新增、編輯和更新自訂文章類型的多條路由。
最少的設定需求。安裝它,為您的文章輸入路由,然後更新永久連結。
使用情境
假設您有一個名為「畫廊」的自訂文章類型,您想要它顯示在兩個專屬頁面上:
/news/gallery/
/media/album/
而單個頁面的網址將是:/news/gallery/<gallery-name> 及 /media/album/<gallery-name>
您只需要:
轉到「設定」 >「自訂文章類型多路由」(您會看到自訂文章類型的列表)
點選您的「畫廊」文章右側的「新增路由」
輸入這條新路由,例如此案例中的「news/gallery」
針對您要新增的每條路由,重複步驟2和3
如果您想要該路由作為自訂文章類型的專屬頁面,請勾選「重新協商此文章類型的專屬頁面至這些路由」的選框
按下「儲存路由」
此外,各自訂文章類型的 WP 管理後台編輯頁面上也會顯示自訂金鑰盤,您可以從那裡選擇專屬路由。預設會顯示在所有定義的路由上。
如果您使用 WPML 進行多語言管理,在新增路由時,每個活動語言都會產生一個輸入框,因此您可以翻譯這些新的路由。
外掛標籤
開發者團隊
② 後台搜尋「Custom Post Type Multiroutes」→ 直接安裝(推薦)
原文外掛簡介
Custom Post Type Multiroutes allows you to manage, add, edit and update multiple routes for your Custom Post Types.
Minimum configuration needed. Install it, type your routes for your posts and refresh permalinks.
Use case
Say you have a custom post type called ‘Galleries’ and you want it to appear on two archive pages:
/news/gallery/
/media/album/
And its single pages to be: /news/gallery/
All you have to do is:
Go to Settings > CPT Multiroutes (you will se a list of your custom post types)
Click on “Add Route” for your ‘Galleries’ post.
Fill the new imput for that new route, in this case ‘news/gallery’
Repeat 2&3 per route you want to add.
Select the checkbox ‘Rewrite this post type archive to these routes’ if you want that route to be your archive page for the custom post type.
Click Save Routes.
Additionally a custom Metabox will appear on each of those custom post types on its admin edit page, there you will be able to choose individually on which route you wish the post to be visible. By default it will be visible on all defined routes.
If you are using WPML for multilanguage, when you add a route, an input for each acive language will appear so you can translate those new routes.
