Hello guys. I have some problem with my code.. I am trying to make code which gonna display the last post from each parent category listed in array.
I mean, there is no error message but also there is no posts showing up.
<?php
wp_reset_query();
$args = array( 'category__and' => array(3,4,5,6,7), 'posts_per_page' => 1);
query_posts( $args );
if (have_posts()) :
echo '<h2>'.$cat->name.'</h2>';
while (have_posts()) : the_post(); ?>
<!-- this area is for the display of your posts the way you want it -->
<!-- i.e. title, exerpt(), etc. -->
<?php endwhile; ?>
<?php else :
echo '<h2>'.$cat->name.'</h2>';
endif; wp_reset_query;
?>
I must solve this problem, I'm despaired.
Thanks!