Preventing get_the_tag_list() loop from duplicating
Question
I have a custom WordPress template where I’m displaying all of the tags inside of a specific category and how many articles are in each tag. I have this working however when I add more articles in the same tag, it adds to the number as it should, but also duplicates the whole row so instead of doing:
tag-a(3)
like I want it to it does:
tag-a(3)
tag-a(3)
tag-a(3)
or
tag-a(2)
tag-a(2)
Here is my code:
<ul class="all-takeaways-cat-list">
<?php
query_posts('category_name=Wealth');
if (have_posts()) : while (have_posts()) : the_post();
if( get_the_tag_list() ){
echo get_the_tag_list(); echo"(";echo $wp_query->found_posts;echo")"; echo '<br>';
}
endwhile; endif;
wp_reset_query();
?>
</ul>
0
4 months
0 Answers
24 views
0
Leave an answer
You must login or register to add a new answer .