Support » Plugins » Hacks » Problems with tags display

  • Resolved rafaht


    I’ve modified a theme to my like. I created a CSS class to the post tags and searching, I found this: I’ve adapted this:

    					$tags = get_the_tags();
    					foreach ($tags as $tag){
    						$tag_link = get_tag_link($tag->term_id);
    						$html .= "<a href=\"{$tag_link}\" title=\"{$tag->name} Tag\" class=\"tags\">";
    						$html .= "{$tag->name}</a>";

    On the first post, the tags is correct. But on the second post or more (I display two posts per page), the tags of first post is repeated with the tags of second posts.
    How can I fix this?
    Thanks so much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz


    Reset $html to an empty string before entering the foreach loop. This essentially discards th old tag data so you have a clean container for the next post.

    Oh! Thank you so much, my problem is resolved! 😀

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problems with tags display’ is closed to new replies.