Posted By

kwilson on 05/25/09


Tagged

wordpress


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

mrbassman12
maxvee8


Single Wordpress loop showing lastest couple posts and headlines for the rest


 / Published in: PHP
 

This example will display the full content of the five most recent posts, and just the headlines from the five before that.

  1. <?php
  2. query_posts('showposts=10');
  3. $count = 1;
  4. ?>
  5. <?php while (have_posts()): the_post(); ?>
  6. <div class="post">
  7. <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
  8. <?php if ($count < 5): ?>
  9. <?php the_content(); ?>
  10. <?php endif; ?>
  11. </div>
  12. <?php $count++; ?>
  13. </div>
  14. <?php endwhile; ?>

Report this snippet  

You need to login to post a comment.