I have my custom post type working, but I can’t seem to get the archives working.
Here is my code for getting the archives:
<ul>
<?php
$args = array(
'type' => 'monthly',
'limit' => '',
'format' => 'html',
'before' => '',
'after' => '',
'show_post_count' => false,
'echo' => 1,
'order' => 'DESC',
'post_type' => 'my_custom_post_type'
);
wp_get_archives( $args ); ?>
</ul>
Here are the args for my CPT:
$args = array(
'label' => __( 'My Custom Post Type', 'realtextdomain' ),
'description' => __( 'What We Are Reading Custom Post', 'realtextdomain' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields'),
'hierarchical' => false,
'public' => false,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => true,
'publicly_queryable' => false,
'menu_icon' => 'dashicons-book',
'capability_type' => 'post',
'rewrite' => array('slug' => 'my_custom_post_type_slug'),
);
register_post_type( 'my_custom_post_type', $args );
I have flushed permalinks, but still nothing showing up for me… any ideas on what I’m doing wrong?