Posted By

LuckyShot on 10/20/09


Tagged

wordpress


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

leaase
stellastreet


Wordpress - Custom loop


 / Published in: PHP
 

Creates custom loop to avoid interfeering with the loop of the page

  1. <h3>Recent Articles</h3>
  2. <ul>
  3. <?php
  4. $recentPosts = new WP_Query();
  5. $recentPosts->query('showposts=5');
  6. ?>
  7. <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
  8. <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li>
  9. <?php endwhile; ?>
  10. </ul>

Report this snippet  

You need to login to post a comment.