I am trying to use WP_Query to output the 3 latest posts with the tag featured. I asked about it here on stackoverflow and got at good tip from a kind person. This is what I have now:
<?php
$home_featured = new WP_Query(array(
'tag' => 'featured',
'posts_per_page' => 3,
));
?>
<?php if ($home_featured->have_posts()): while ($home_featured->have_posts()) : $home_featured->the_post(); ?>
<p>Got some</p>
<?php endwhile; ?>
<?php else: ?>
<p>None found</p>
<?php endif; ?>
Now, I have 3 posts that have the tag featured. Since Wordpress uses a while loop here, it should do one iteration per post up to 3 times, outputting a
Got some
. This should result in something like this on the screen:Got some Got some Got some
But it only outputs it one time, like this:
Got some
What is wrong?