我正在尝试为自定义帖子类型实现存档:
http://mywebsite:8888/about-us/client-news/2015/03/
问题是,它一直在为我提供404页面,我无法找出它找不到的页面模板。我试过打开调试和其他一些步骤
注册:
function client_news() {
$labels = array(
\'name\' => _x("Client News", "post type general name"),
\'singular_name\' => _x("Client News Item", "post type singular name"),
\'menu_name\' => \'Client News\',
\'add_new\' => _x("Add New", "news item"),
\'add_new_item\' => __("Add New News Item"),
\'edit_item\' => __("Edit News Item"),
\'new_item\' => __("New News Item"),
\'view_item\' => __("View News Item"),
\'search_items\' => __("Search Client News"),
\'not_found\' => __("No Useful Items Found"),
\'not_found_in_trash\' => __("No Useful Items Found in Trash"),
\'parent_item_colon\' => \'\'
);
// Register post type
register_post_type(\'clientnews\' , array(
\'labels\' => $labels,
\'public\' => true,
\'has_archive\' => true,
\'rewrite\' => array( \'slug\' => \'news\' ),
\'supports\' => array(\'title\', \'editor\', \'thumbnail\')
) );
}
add_action( \'init\', \'client_news\', 0 );
归档循环如下:
<ul class="news_archive">
<?php
add_filter( \'get_archives_link\', \'get_archives_clientnews_link\', 10, 2 );
wp_get_archives( array( \'post_type\' => \'clientnews\', \'type\' => \'monthly\' ) );
remove_filter( \'get_archives_link\', \'get_archives_clientnews_link\', 10, 2 );
?>
</ul>