Your query args are messed up. Posts per page and offset params are not part of the tax_query
array. Check out the example in the Codex:
$args = array(
'post_type' => array('your_cpt'),
'posts_per_page' => 3,
'offset' => 3,
'tax_query' => array(
'relation' => 'OR',
array(
'taxonomy' => 'brands',
'terms' => array('iHOME'),
'field' => 'slug',
)
)
);
$tax_query = new WP_Query($args);
if ( $tax_query->have_posts() ) : while ( $tax_query->have_posts() ) : $tax_query->the_post();
the_post_thumbnail();
the_title();
echo excerpt(25);
echo esc_html( get_post_meta( get_the_ID(), 'category', true ) );
endwhile; else:
endif;
wp_reset_postdata();
Also, I couldn’t really explain why, but I always see it written around here to avoid using query_posts
, so I replaced that in my answer with new WP_Query
.
One more thing, if you are querying for a post type other than posts, you’ll need to define the post_type
query parameter.