Recent Topics

[2.4.2 ]Tag cloud widget to display tags from all blogs?

Started by on Jun 13, 2008 – Contents updated: Feb 05, 2013

Jun 13, 2008 20:26    

is it possible to hack the tag cloud to display tags from all blogs?


Jun 13, 2008 20:32

I think yes, I will try to provide you the right sql request for this.

Jun 18, 2008 11:19


Does anybody know if it is possible?
I'd like the tag cloud to display the tags from all or selected blogs.

Help will be much appreciated.


Jun 18, 2008 14:35

Change the query in /inc/widgets/widgets/_coll_tag_cloud_widget.php from line 148 onward to:


$sql 'SELECT LOWER(tag_name) AS tag_name, COUNT(itag_itm_ID) AS tag_count
                          FROM T_items__tag INNER JOIN T_items__itemtag ON itag_tag_ID = tag_ID
                                      INNER JOIN T_postcats ON itag_itm_ID = postcat_post_ID
                                      INNER JOIN T_categories ON postcat_cat_ID = cat_ID
                                      INNER JOIN T_items__item ON itag_itm_ID = post_ID
                         WHERE /* cat_blog_ID = '.$Blog->ID.' AND */ post_status = "published" AND post_datestart < NOW()
                         GROUP BY tag_name
                         ORDER BY tag_count DESC
                         LIMIT '.$this->disp_params['max_tags'];

Good luck

Jun 18, 2008 17:03

Hello Afwas,

I've tried what you've said and it displays the tags from all blogs, right enough, but the links point to the tags in the blog you are and not the blogs where the tags are..

If I'm in blog 5 clicking on a tag from a different blog I only get "Sorry, there is nothing to display...". :(

Are there any suggestions you want to make?


Jun 18, 2008 18:27

1) Thange the first line from the code above to:


$sql 'SELECT LOWER(tag_name) AS tag_name, COUNT(itag_itm_ID) AS tag_count, cat_blog_ID

2) On or around line 200 change that line to:


echo '<a href="'.url_add_param$Blog->gen_tag_url$row->tag_name ), 'blog=' $row->cat_blog_ID '') . '" style="font-size: '.$size.'pt;" title="'
                        .sprintfT_('%d posts'), $row->tag_count ).'">'.format_to_output($row->tag_name).'</a>';

Mind that tags don't agregate, so tag "blog" on blog1 is something different than tag "blog" on blog5. For the rest this should work.

Good luck

Jun 22, 2008 03:00

In this topic [url=][2.4.2] Problem with tag cloud (the one from the core)[/url] you find more information on this widget. Based on experiences shared there I suggest you alter the first line of the query to:


$sql 'SELECT LOWER(tag_name) AS tag_name, COUNT(DISTINCT itag_itm_ID) AS tag_count, cat_blog_ID

That's adding the 'word' DISTINCT to avoid the same tag being counted more than once if the post has multiple categories.

Feb 02, 2013 09:33

Is there any way to use this with v 3.3.2? I'm trying to get the same thing to work and am having trouble getting the tags to point to the right blog.

Form is loading...

powered by b2evolution free blog software – This forum is powered by b2evolution CMS, a complete engine for your website.