All Posts are shown even when querying only a certain post taxonomy
-
Hi! Can someone tell me what’s wrong with my code? I’m trying to call posts that belong to a certain post taxonomy only but all the other posts are displayed:
<?php $args = array( 'tax_query' => array( array( 'taxonomy' => 'post_taxomony', 'field' => 'id', 'terms' => '7' ) ) ); $query = new WP_Query( $args ); ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div class="testimonialImg"><div class="testimonialImgBorder"> <?php if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it. the_post_thumbnail( array(100,100) ); } ?></div></div> <div class="testimonialTxt"><?php the_content(); ?></div> <?php endwhile; else: ?> <p><?php _e('No posts found.'); ?></p> <?php endif; ?>
Thanks! ??
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘All Posts are shown even when querying only a certain post taxonomy’ is closed to new replies.