Tuesday, June 29, 2010

display the_content with setup_postdata

<?php

global $more;

$cat= 3;
$posts = get_posts ("cat=$cat&showposts=5");
if ($posts) {
foreach ($posts as $post):
$more = false;
setup_postdata($post);
?>
<h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
<p class="storycontent"><?php the_content('Read more...'); ?></p>
<?php
endforeach;
$more = true;
}

?>

No comments:

Post a Comment