Displaying the number of posts in the tag cloud

Jerome's Keywords Plugin by using You can display tags as clouds in WordPress.

However, when this plug-in displays the tag cloud, it is not possible to know how many tags there are. This plugin is famous for tags as well http://technorati.com/tags/ is also not displayed.





tag on flickrLikewise, there is no indication of the number.




http://del.icio.us/tag/ also the same




It does not display the number of articles in the relevant tag. Is it because there are too many posts? Or is it because I don't feel the need to?


The size of tags in the tag cloud is the relative size between tags with respect to the number of posts.

The size of a tag in the tag cloud is basically based on the number of posts in the tag. Then, the relative size between tags is displayed as the font size of the tags. I usually use css to adjust the font size.

By looking at the size of the tags in the tag cloud, you can see how many posts there are between tags, but you can't tell how many posts are actually there. This is because the tag cloud displays the number of articles in the tag as the relative size between the tag and the tag. thus Visualize informationHowever, basic information must be shown. I think that the number of articles in the tag is the basic information of the tag group.

At the same time, relative representations of numbers can be misleading compared to absolute representations. Tags in the tag cloud are similar to displaying a certain frequency as a percentage. If an item is 50% or 50%, both are the same percentage within it. However, the frequencies may be 10 and 10, or 1 million and 1 million. This is similar to looking at ratios and frequencies when looking at numbers.

So I think it is necessary to show the number of posts of that tag in the tag cloud.

And I decided to show it.


Display the number of posts when the mouse hovers over a tag

how to display I thought it would be awkward to display a number next to a tag, so I made it look the same as it is now, but only show the number of posts when necessary. In other words, it is a method to display the number of posts when the mouse is over. It is possible to make it visible as soon as the mouse hovers over it with JavaScript, but I thought it would be better to simply use the TITLE tag to make it visible after the default time of 1 second.

In this way, tags can be identified just like the existing tag cloud, and which tags there are many. And when you want to know the number of articles, you can hover your mouse over it. In order to display the number of articles, we did not change all the existing ones, but left them as they are and made it possible to see the necessary information when needed through interaction.




How to display the number of posts

Geromi's source code didn't support it, so I decided to just fix it myself.

Looking at the source code of Zeromi, I found that the actual number of posts is calculated in the source code, but it is converted back to the relative number between tags when outputting. added That's postcount.

Hovering the mouse over the tag link in the tag cloud displays the actual number of posts. If you want to display it right away instead of when you hover over it, you can use the %postcount% below in an appropriate place.

Write how to directly modify the source code.

1. Edit jeromes_keywords.php.

Add title="%postcount%" to all_keyword function

function all_keywords($element = ' %keyword% ', $element_cat = ”, $min_scale = 1, $max_scale = false, $min_include = 0) {

$keytemp = str_replace('%count%', $keycount, $keytemp); Add the following below:

$keytemp = str_replace('%postcount%', $count, $keytemp);

2. Add postcount to cosmos.php or sidebar.php to display tag cloud as follows.

%keyword% ', ”, 1, 15); ?>

tag page on my blog can be seen in action.


0 If you like the article, please click the heart~ It will be a strength to bloggers (SNS/login/advertising is not related)

Articles you might like

108 times Jeoldong-jeom-jeom-jeom site
108 times counter that automatically recognizes and counts by voice

Add a Comment

Email addresses are not disclosed. Required items *is indicated by

This posting is part of Coupang Partners' activities, and a certain amount of commission is provided accordingly.