How do you display a list of archive(last 6 months or so) for custom post types? Something like this: https://blog.evolveformazione.com/
1 Answer
For anyone still struggling with this, here's a solution:
$args = array(
'post_type' => 'your_custom_post_type',
'post_status' => 'publish'
);
$query = new WP_Query($args);
?>
Then output it anywhere in your template like so: //Output
<?php wp_get_archives($args); ?>
<?php the_widget( 'WP_Widget_Archives' ); ?>
- which spits out a list of all archive from feb 2019. But the same would not work for custom post types! How do I get around this, please?