If I search by tags in smart search module it lists all tags.If I click on the tag it lists artices with that tag.Instead if I search by tags is there anyway to directly list articles with that tags??Please help me.
1 Answer
I can't give you a complete answer, but hopefully point you in the right direction with a couple of resources.
You can override the tag search results by copying this file:
/components/com_finder/views/search/tmpl/default_result.php
to
/templates/default_template/html/com_finder/search/default_tag.php
(Notice the name change)
(Read more here on Smart Search overrides here.)
But honestly I'm not sure exactly how to get this view to display all articles with the tag in the search query. This answer has a code to get articles with a certain tag:
$tagsHelper = new JHelperTags;
$articles = $tagsHelper->getTagItemsQuery( $tagId, 'com_content.article', true, 'c.core_publish_up', 'DESC', true, 'all', '1' );
There's also a module available to display articles with a certain tag, maybe you can extract some of the code from it: https://github.com/lasinducharith/joomla-tags-selected
You'll probably have to work a little to put everything together, but it should absolutely be possible.
Hope this helped a little :)