I’m using wp_get_archives to retrieve a monthly list of dates for posts have been posted in my custom post type ‘download’.
But it is not working, what I am doing wrong?
I am using workpress 3.3
Thanks
CODE
<?php $args = array(
'post_type' => 'download',
'type' => 'monthly',
'show_count' => '1'
); ?>
<?php wp_get_archives( $args ); ?>
THIS IS HOW I REGISTERED MY CUSTOM POST TYPE FOR REFERENCE
// Downloads Post Type
add_action( 'init', 'create_post_type' );
function create_post_type() {
$args = array(
'labels' => post_type_labels( 'Download' ),
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => true,
'has_archive' => true,
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => null,
'taxonomies' => array( 'group' ),
'supports' => array('title',
'editor',
'author',
'thumbnail',
'excerpt',
'comments'
)
);
register_post_type( 'download', $args );
}
wp_get_archives( ); does not support ‘post_type’ as an argument.
There is a discussion [here][1]: http://wordpress.org/support/topic/archive-list-and-page-for-custom-post-types-mysql?replies=9 about hacking in support for it. The article has a few links off to another solution using a filter which is applied to the sql query for selecting posts to include in the archives result. Looking at how the filter is applied in general-template.php it should also work.
Some hints:
Hint 1 Use custom-post-type-archives plugin (update Permalinks after any change)
Hint 2 WPML plugin + custom-post-type-archives: