• I have four different sidebars to deal with: one for the blog proper, and three others for pages dedicated to custom post types. My problem is: how do I exclude all other post types from the archives on those pages?

    I tried this drop down:

    <select name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;">
    <option value=""><?php echo esc_attr( __( 'Select Month' ) ); ?></option>
    <?php wp_get_archives( array( 'post_type' => 'name_of_post_type', 'type' => 'monthly', 'format' => 'option', 'show_post_count' => 1 ) ); ?>
    </select>

    …but that doesn’t work. I didn’t really expect it to…”post_type” isn’t a parameter listed on the wp_get_archives page in the Codex. So, how would this be accomplished?

Viewing 1 replies (of 1 total)
  • I think this plugin could help with your issue – Custom Post Type Archives

    It provides this:

    wp_get_post_type_archives – will work the same way as ‘wp_get_archives’ function that allows you to get yearly, monthly, daily (and so on) archives for custom post types.

Viewing 1 replies (of 1 total)

The topic ‘How to make Archives dropdown for custom post type?’ is closed to new replies.