WordPress.org

Forums

Loop to show posts with current term of taxonomy (1 post)

  1. jumust
    Member
    Posted 2 years ago #

    I've created a custom post type and a custom taxonomy to go with it.

    I can't figure out how to program the loop on the taxonomy.php template to make it only show the posts that correspond with the current term of its taxonomy. <domain>taxonomy/term

    <?php
      $args = array( 'post_type' => 'domande-offerte', 'tag' => get_query_var('citta'), 'posts_per_page' => 15 );
      $loop = new WP_Query( $args );
      while ( $loop->have_posts() ) : $loop->the_post();?>
    <?php wp_pagenavi(); ?>

    Taxonomy: citta

    What am I doing wrong?

Topic Closed

This topic has been closed to new replies.

About this Topic