Show Tags in List Layout (Joomla 4.X) Topic is solved

Everything to do with Joomla! 4.x templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Jan 06, 2020 2:50 pm

Show Tags in List Layout (Joomla 4.X)

Post by rinenweb » Tue Oct 31, 2023 11:34 am

Hello, I ran across this topic which was exactly what I needed, but for Joomla 3.X.

Since it got working for Joomla 4.X with a few changes, I thought it would be useful to share these changes. :)

So, as it always starts with, create an HTML override for the default_articles.php:

Code: Select all

First, put another helper around the start of the file (among other helpers):

Code: Select all

use Joomla\CMS\Layout\LayoutHelper;
Then, around lines 130-160, where the columns are created, create an additional column for the tags. Place the following code where you need it:

Code: Select all

                    <th scope="col" id="categorylist_header_tags">
                        <?php echo HTMLHelper::_('grid.sort', 'JTAG', 'tags', $listDirn, $listOrder); ?>
Finally, around lines 280-320, place the following code where you want to call these tags...

Code: Select all

                <td class="list-tags">
                    <?php echo LayoutHelper::render('joomla.content.tags', $article->tags->itemTags); ?>
I would assume that by now Joomla 4.X or even 5.X would offer the possibility to automatically add a tags column in a category list via the menu item's settings. But until it does, the above-mentioned override should do the trick. ;)

Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Fri May 24, 2024 8:40 am

Re: Show Tags in List Layout (Joomla 4.X)

Post by thomasesman » Fri May 24, 2024 8:48 am

Thank you very much for this solution.
I have one issue: the tag is vertically centered and above and below the tag is space in the cell. So the height of the cell is about 3 lines. The content of the other cells are aligned on top, so the layout of the table is not nice. It looks like the lines above and below the tag cause the problem. I added a screenshot to clarify. How can I change this?
Screenshot 2024-05-24 104613.png
I'm using Purity iv template.

Thank you!
You do not have the required permissions to view the files attached to this post.

Post Reply

Return to “Templates for Joomla! 4.x”