WordPress 3.6 query by post format not working -
i'm using ifttt post instagram photos blog image post format posts. want display recent image post.
this code should working, displaying 3 posts on blog (it's new, there 2 standard posts , 1 image post).
<?php $latest_instagram = get_posts( array( 'showposts' => 1, 'tax_query' => array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => 'post-format-image', 'operator' => 'in' ) ) ) ); ?> <?php $instagram = new wp_query($latest_instagram); ?> <?php while ($instagram->have_posts()) : $instagram->the_post(); ?> <?php the_content(); ?> <?php endwhile; ?>
everything i've looked suggest way go. ideas? thanks.
try replacing showposts posts_per_page
//edit noticed using get_posts passing query. remove get_posts() function , should good!
<?php $latest_instagram = array( 'showposts' => 1, 'tax_query' => array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => 'post-format-image', 'operator' => 'in' ) ) ); ?> <?php $instagram = new wp_query($latest_instagram); ?> <?php while ($instagram->have_posts()) : $instagram->the_post(); ?> <?php the_content(); ?> <?php endwhile; ?>
Comments
Post a Comment