2017-03-17 98 views
4

我稱之爲「視頻」和自定義分類「渠道」WordPress的重寫規則

我要重寫我的視頻詳情頁面這樣的定製post_type:

http://example.com/funny/<postname> 

這裏「有趣」是通道術語。

我試着像一些代碼:

add_permastruct('video', '%channels%/%video%'); 

它的正常工作,但是當我試圖打開後的詳細信息頁面,其固定鏈接結構爲:

http://example.com/<parent_category>/<postname> 

它不工作。所有帖子單頁顯示404.

請幫幫我。

回答

0

你應該achive你的結果定製您的文章類型定義重寫屬性:

自定義文章類型ID - >視頻

視頻自定義分類ID - >ct_video

Custom Post type id - >channels

渠道自定義分類ID - >ct_channels,如果你想自定義您的自定義後類型或對自定義分類存檔或頁面

'rewrite' => array('slug' => '[custom url]') 

個性化你的帖子的網址我建議您下載定製發佈類型固定鏈接https://wordpress.org/plugins/custom-post-type-permalinks/ 並且您可以像這樣使用它:

enter image description here

使用結構來定義一個定製後柱型網址