How to edit wordpress tag cloud tooltip text.


Another issue i faced during the wordpress development, i want to change the tooltip text which appears on hovering the mouse over the tags created by wp_tag_cloud().

By default it shows something like 5 topics, 2 topics etc, and i want to make it something like 5 Projects tagged

So how to do it …?

Open category-template.php which is located under /wp-includes folder.

Search for this line

function default_topic_count_text( $count )

Under there you will find the following code

return sprintf( _n('%s topic', '%s topics', $count), number_format_i18n( $count ) );

Change the “topic” and “topics” string according to your need. As far my example is concern i changed it to this

return sprintf( _n('%s Project Tagged', '%s Projects Tagged', $count), number_format_i18n( $count ) );

Thats it!..
Another example to explain it further
%s is the variable that stores the number of post and it is followed by a string which can be any, so lets say i want to say, There are 9 topics, i will change it to

return sprintf( _n('There are %s Topic', 'There are %s Topics', $count), number_format_i18n( $count ) );

Fist string is for singular and second is for plural

I hope this helps!

One thought on “How to edit wordpress tag cloud tooltip text.”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s