Support » Plugin: Tag Groups » “php the_tags” just for a certain group ?

  • Resolved TB54


    Hello !
    (french here, sorry for my english…)

    Thanks for the plugin, that helped me a lot. I am kind of a newbie (pretty lost outside html/css, that’s why i use plugins), so if the question that follows is too much work, no problem !

    In my “content-single.php”, I call all the tags of the post (to show the list of them) like that :

    <?php the_tags( '# ', '<br/># ', '' ); ?>

    I would like to call only the tags of one specific group (in order to separate them by groups on the list). Is there a way (a kind of “php this_group”) to do that with the groups of this plugin ? (i have the free version).

    What I see in the documentation seems only to concern tag clouds, but maybe i missed something…

    Thanks again for the plugin !

    • This topic was modified 1 year, 3 months ago by TB54.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Chris



    The premium plugin has that feature out of the box:

    With the free plugin it is also possible but you cannot avoid some coding. You can use the function tag_groups_cloud with the 2nd parameter set to true in order to return an array of tags. With the parameter “tags_post_id” you display only tags that belong to a particular post. If it is 0 then we try to get the tags of this post.

    Here is one example:

    $post_tags = tag_groups_cloud( array( 'tags_post_id' => 0 ) , true );
    foreach ( $post_tags as $post_tags_group ) {
    	echo "<h3>" . $post_tags_group['name'] . "</h3>";
    	echo "<ul>";
    	if ( ! empty( $post_tags_group['tags'] ) ) {
    		foreach ( $post_tags_group['tags'] as $post_tag ) {
    			echo '<li><a href="' . $post_tag['link'] . '" title="' . htmlentities($post_tag['description']) . '">' . htmlentities($post_tag['name']) . '</a></li>';
    	echo "</ul>";

    I hope that this is what you need.

    I’m afraid I’m too noob to know how to properly handle this code (and can not afford the premium version for the moment), but I will ask for help from some friends, and the info you gave me will help.

    Thank you so much for your time !

    EDIT : oh, i just understood, it works perfectly. Thanks !

    • This reply was modified 1 year, 3 months ago by TB54.
    Plugin Author Chris


    This would replace the the_tags( '# ', '<br/># ', '' ); part

    // copy it here

    But I totally agree that it is the best to let someone do it who knows PHP because if there is something wrong in the code it might break your website.

    Good luck! 🙂

    This would replace the the_tags( ‘# ‘, ‘<br/># ‘, ” ); part

    Yes, I was a bit slow to understand that 😀
    (I was doing ugly things to “functions.php”…)

    Thanks again !

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘“php the_tags” just for a certain group ?’ is closed to new replies.