WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Listing posts filled under a Taxonomy category (2 posts)

  1. moffepoffe
    Member
    Posted 3 years ago #

    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

  2. moffepoffe
    Member
    Posted 3 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic