I’ve been trying to utilize either WP_Query
or get_posts
to pull out the most recent post that’s both in a specific category and of a specific post format.
<?php
$singargs = array(
'numberposts' => 1,
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => array ( 'gift-of-the-day' ),
),
array(
'taxonomy', => 'post_format',
'field' => 'slug',
'terms' => array( 'aside'),
)
)
);
$singPost = new WP_Query( $singargs );
foreach ( $singPost as $post ) : setup_postdata($post); ?>
<aside>
<h2><?php the_title(); ?></h2>
</aside>
<?php endforeach; wp_reset_postdata(); ?>
What am I doing wrong here?