WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] having duplicate tags ignored in only one query_post (2 posts)

  1. blackbookdesign
    Member
    Posted 5 years ago #

    Hi I have a question regarding tags in query_post.

    My goal is to have all tags used in a query echoed but I don't want the same tag echoed more the once.

    I was thinking of the duplicate post technique but it needs two queries.

    It could have to do with the way I am querying as well... maybe needs arrays and variables... it's getting a touch out of my wp understanding...

    I am sure there's a way to kill a duplicate entry so can somebody help me out or give me a lead to a similar problem that was resolved?

    Thanks heaps,
    Brian

    <ul id="filter">
    <?php query_posts("posts_per_page=-1&amp;cat=5");?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php
    global $post;
    if ( has_tag() ) { ?>
    <li><a href="#"><?php
    $posttags = get_the_tags();
    if ($posttags) {
    foreach($posttags as $tag) {
    echo $tag->name . '';
    }
    }
    ?></a></li>
    <?php } else {
    
    }?><?php endwhile; ?><?php endif; ?>
    </ul>
  2. blackbookdesign
    Member
    Posted 5 years ago #

    ok I managed to "hack" my site into getting this to work.. well It's pretty easy, I used this:

    2.8-bleedingedge WP

    with
    <?php wp_tag_cloud('smallest=12&largest=12&format=list&taxonomy=post_tag'); ?>
    It does what wanted it to do by I'm using an "unstable" version of WP and the incredible taxonomy parameter for tag clouds!

    Good Thinking WP dev team!

Topic Closed

This topic has been closed to new replies.

About this Topic