WordPress.org

Support

Support » Themes and Templates » [Resolved] Listing posts filled under a Taxonomy category

[Resolved] Listing posts filled under a Taxonomy category

  • Hey,

    I’ve run into a big problem, im trying to create a list of all the posts filled under a Taxonomy category, but i cant get it right. It doesnt output anything or it gives me the wrong output.

    Here’s the code:

    <?php $loop = new WP_Query( array( 'tag_ID' => '5' ) );
    while ( $loop->have_posts() ) : $loop->the_post();
      echo '<li class="page_item"><a href="';
      the_permalink();
      echo '">';
      the_title();
      echo '</a></li>';
    endwhile;
    ?>

    After reading for many hours i finally discovered that a category created under a Taxonomy is NOT a category, it seems like its a Tag, which is why im using the tag_ID. And as i can tell from the backend is that the tag_ID of that category i want to output is 5.

    Can someone please come with any tips.

    All the best,
    Marten

Viewing 1 replies (of 1 total)
  • solved it by myself by reading the codex one more time
    <?php $loop = new WP_Query( array( 'Taxonomy' => 'under-tax/category' ) );

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Listing posts filled under a Taxonomy category’ is closed to new replies.
Skip to toolbar