無論如何有每年或每月在WordPress的自定義帖子類型的檔案? 我已經搜索了很多,無濟於事。 我會想象的URL結構是這樣的:WordPress的自定義帖子類型每年/每月檔案
http://sitename/custom-post-type/year/month
有人嗎?
無論如何有每年或每月在WordPress的自定義帖子類型的檔案? 我已經搜索了很多,無濟於事。 我會想象的URL結構是這樣的:WordPress的自定義帖子類型每年/每月檔案
http://sitename/custom-post-type/year/month
有人嗎?
我的插件Custom Post Permalinks可讓您調整固定鏈接設置。但是,截至目前,它只適用於非分層的帖子類型。我正在開發一個允許這兩種類型的新版本。
您可以試試這段代碼。將陣列中的CPT替換爲您的CPT名稱。
此功能將轉換下列URL
到
這實際上是使用由WordPress。
add_action('init', 'date_cpt_rewrites');
function date_cpt_rewrites() {
$custom_post_types = array('CPT'); //some example post types
foreach ($custom_post_types as $post_type) {
$rule = '^' . $post_type . '/(\d+)/(\d+)/?$';
$rewrite = 'index.php?post_type=' . $post_type . '&m=$matches[1]$matches[2]';
add_rewrite_rule($rule,$rewrite,'top');
}
}
這個插件獲取固定鏈接結構的工作:http://wordpress.org/extend/plugins/custom-post-permalinks/ 但仍不能產生一個列表中給出了正確的鏈接,每年的存檔的自定義帖子類型。 – beetrootman 2010-09-26 18:28:35