I am trying to implement an archive for a custom post type:
http://mywebsite:8888/about-us/client-news/2015/03/
The problem is that it keeps serving me a 404 page and I cannot work out what page template its failing to find. I have tried turning on debug and a number of other steps
The registration:
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 );
Archive loop is as follows:
<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>
/clientnews/
.