I have a site with many articles, each articles has own tags, they are assigned to 3 main categories, lets say:

  • Cat. "Blog Food": 15 articles with own tags
  • Cat. "Blog Travel": 25 articles with own tags
  • Cat. "Blog Hotel": 10 articles with own tags

I have 3 menu items with Blog view, each menu shows articles from one category, so I have 3 different blogs.

Now what I want to do is to show a "Popular tags" in each blog, showing tags only from this specific category.

The problem I have is that the module shows tags from all the articles, so tags from "food" blog are shown also in the "hotel" blog.

How can I make possible to show tags selecting the "source" of the tags, from example add a "popular tags" module on "food" blog that shows only tags taken from articles that are in "food" category.

I have tried to use the built in tags module and couple other additional module, but they show only all the tags from all the articles.

1 Answer 1


I suggest you develop your own module to do what you want. If I understand you right, you're saying that the Joomla mod_tags_popular does mostly what you want, apart from restricting the tags. So start with that module as the basis.

You'd be best to check the URL parameters (see Requesting Data with JInput) to ensure that option=com_content and view=category, then your category id will be given by the id URL parameter.

Then you'll have to restrict the SQL query in the mod_tags_popular helper.php file by finding records from the #__ucm_content table where core_catid matches your id.

So after the lines:

$query->join('INNER', $db->quoteName('#__tags', 't') . ' ON ' . $db->quoteName('tag_id') . ' = t.id')
        ->join('INNER', $db->qn('#__ucm_content', 'c') . ' ON ' . $db->qn('m.core_content_id') . ' = ' . $db->qn('c.core_content_id'));


$query->where($db->qn('c.core_catid') . ' = ' . $id);

where $id contains the id URL parameter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.