Support » Fixing WordPress » return tags with more than 5 posts

  • Resolved gerald@WPcustoms

    (@geeman12030)


    Hello,

    I call the tags this way:

    <?php
    $tags = get_tags();
    foreach (get_tags() as $tag){
    	$tag_link = get_tag_link($tag->term_id);
    	$html .= "<li><a href='{$tag_link}/' title='{$tag->name} Tag' >{$tag->name}</a>($tag->count)</li>";
    echo $html;
    ?>

    now this code returns all tags but I only want to display the tags which have more than 5 posts. Can somebody please help me with this?
    Thanks in advance
    Regards,
    geeman

Viewing 3 replies - 1 through 3 (of 3 total)
  • vtxyzzy

    (@vtxyzzy)

    I think this is what you want:

    <?php
    $tags = get_tags();
    foreach (get_tags() as $tag){
       if ($tag->count < 6) continue;
       $tag_link = get_tag_link($tag->term_id);
       $html .= "<li><a href='{$tag_link}/' title='{$tag->name} Tag' >{$tag->name}</a>($tag->count)</li>";
    }
    echo $html;
    ?>
    gerald@WPcustoms

    (@geeman12030)

    works like a charm!
    thanks a lot for this solution 🙂

    Yoink….that’s good code if I may chime in. Thanks for enhancing my archive page even more!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘return tags with more than 5 posts’ is closed to new replies.