I don’t know if this is the best solution, but it seems to work.
- Change the call to
get_tags()
so that it gets the tags required, in the order required. - Add a loop that generates the link for each of those tags.
- Then generate the tag cloud for those tags.
So I end up with:
add_shortcode('popular_tag_list', 'custom_popular_tags');
function custom_popular_tags() {
$tags = get_tags(array(
'number' => 30,
'orderby' => 'count',
'order' => 'DESC',
));
foreach ($tags as &$tag) {
$tag->link = get_tag_link($tag->term_id);
}
$args = array(
'smallest' => 1,
'largest' => 1,
'unit' => 'em',
'format' => 'list',
'separator' => "n",
'show_count' => 0,
'echo' => false
);
$tag_string = wp_generate_tag_cloud( $tags, $args );
return $tag_string;
}
add_filter ('widget_text', 'do_shortcode');