Quote:
Originally Posted by nico-t
this works for me:
Code:
<?php
global $post;
$myposts = get_posts('numberposts=6&category=3&orderby=rand');
foreach($myposts as $post) :
setup_postdata($post); ?>
<?php
global $more;
$more = 0;
?>
<div class="postboxmain" id="post-<?php the_ID(); ?>">
REST OF YOUR POST TEMPLATE HERE
</div>
<?php endforeach;
wp_reset_query();
?>
|
Unless you're running a loop inside of a loop, or working directly with a wpdb query then there is absolutely no reason to use a foreach loop...