How do I list recent posts but make an exception for the very latest post?
Does anyone know of a widget/plug-in that does this. Or a code snippet that would call such a list?
How do I list recent posts but make an exception for the very latest post?
Does anyone know of a widget/plug-in that does this. Or a code snippet that would call such a list?
<?php
$args=array(
'offset'=> 1,
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => 5,
'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo '5 latest posts offset by one';
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
<?php
endwhile;
}
wp_reset_query(); // Restore global post data stomped by the_post().
?>Thanks Michael - "offset" was the term I needed to search for. I found this, too:
http://trulydotnet.wordpress.com/2010/02/06/posts-list-with-offset/
This topic has been closed to new replies.