Ad Code

Responsive Advertisement

Ticker

6/recent/ticker-posts

How to Display Most Popular Tags in WordPress

Want To Display Most Popular Tags in WordPress. in this tutorial, we will tell you how?

This method is easier and recommended for most users.
The first thing you need to do is install and activate the Simple Tags plugin. For more details, see our step by step guide on how to install a WordPress plugin.
Upon activation, you need to visit Appearance > Widgets page and add ‘Tag Cloud (Simple Tags)’ widget to the sidebar.


function wpb_tag_cloud() { 
$tags = get_tags();
$args = array(
 'smallest'                  => 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('wpb_popular_tags', 'wpb_tag_cloud'); 

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


This code simply generates the top 10 tags from your website in a cloud with a number of posts in each tag. After that, it creates a shortcode wpb_popular_tags and enables shortcode in a text widget.
You can now add the shortcode [wpb_popular_tags] in any post, page, or widget to display your most popular tags.

Plugin Link:
https://wordpress.org/plugins/simple-tags/

How To Install Plugin:

  • Unzip “Simple tags” archive and put all files into a folder like “/wp-content/plugins/simple-tags/”
  • Activate the plugin through the ‘Plugins’ menu in WordPress
  • Inside the WordPress admin, go to Options > Simple Tags, adjust the parameters according to your needs, and save them.

Post a Comment

0 Comments

Ad Code

Responsive Advertisement