Archive links for custom post types

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); ?>