Using Tag Groups: Displaying groups and adjacent tags of current post


I am trying to use tag groups (plugin) and tags as a way to display basic info on a portfolio/blog website’s posts. I have organised them as *ex. Tag Group: Year / Tags: 2012, 2013, 2014… etc and tag each post with one tag from each group. What I want to display on a post/project page is Year: 2013, – display the name of the group and the adjacent tag for this post only.

So far, I have made a table and managed to display only adjacent tag groups, but I cannot filter the tag for the post. As an output I get “Group: All tags in it”.

I am building the site myself and started with all web coding from zero a couple of months ago, so any help would be appreciated. I think that I miss a condition in the “foreach” function, but I am not sure at all.

This is the code:

$groups = tag_groups_cloud( array( ‘groups_post_id’ => ‘0’, ‘orderby’ => ‘count’, ‘order’ => ‘DESC’ ) , true );

                <?php if ( $groups ) foreach ( $groups as $group ): ?>
                    <th><?php echo $group['name'] ?></th>
                <?php endforeach; ?>
                <?php foreach ( $groups as $group ): ?>
                        foreach ($group['tags'] as $tag ):
                            <a href="<?php echo $tag['link'] ?>"><?php echo $tag['name'] ?></a></li>

                        <?php endforeach; ?>
                <?php endforeach; ?>
, , , bonev 3 years 2020-03-30T20:52:44-05:00 0 Answers 87 views 0

Leave an answer