Display Popular Tags in WordPress

210 Views

you’ll need to add following code to your current themes functions.php file.

10,
‘largest’ => 22,
‘unit’ => ‘px’,
‘number’ => 10,
‘format’ => ‘flat’,
‘separator’ => ” “,
‘orderby’ => ‘count’,
‘order’ => ‘DESC’,
‘show_count’ => 1,
‘echo’ => false
);

$tag_string = wp_generate_tag_cloud( $tags, $args );

return $tag_string;

}
// Add a shortcode so that we can use it in widgets, posts, and pages
add_shortcode(‘wc_popular_tags’, ‘wc_tag_cloud’);

// Enable shortcode execution in text widget
add_filter (‘widget_text’, ‘do_shortcode’);

?>

Was this article helpful?
YesNo

Leave a comment

Your email address will not be published.