function shortcode_cp_archive( $atts ) {
$post_type = get_query_var('post_type');
if (empty($post_type)) {
$post_type = 'post';
}
ob_start(); // Start output buffering
echo '<ul class="list-no-mark">';
wp_get_archives(array(
'type' => 'monthly',
'show_post_count'=> 0,
'post_type' => $post_type,
));
echo '</ul>';
return ob_get_clean(); // Return the buffered output
}
add_shortcode('cp_archive', 'shortcode_cp_archive');
call like a
[cp_archive post_type="'work"]