Posted By

austinhappel on 12/07/10


Tagged

loop


Versions (?)

get_posts - reset post list after finished


 / Published in: PHP
 

  1. <ul>
  2. <?php
  3. global $post;
  4. $tmp_post = $post;
  5. $myposts = get_posts('posts_per_page=5&offset=1&category=1');
  6. foreach($myposts as $post) :
  7. setup_postdata($post);
  8. ?>
  9. <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
  10. <?php endforeach; ?>
  11. <?php $post = $tmp_post; ?>
  12. </ul>

Report this snippet  

You need to login to post a comment.