Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to use the query_posts() function to limit the posts to all but the most recent on one of my templates. This is because the most recent post is a featured item alone on it's own page where as the rest of the posts are to be on another page. It was easy enough to display the most recent one on one of my templates:

<?php query_posts(array('category_name' => 'Recipe of the Week', 'posts_per_page' => 1)); ?>

So basically I'd like something like that but to limit it to all but the first post.

Thanks, John.

share|improve this question
add comment

2 Answers 2

I had to use the WP_Query class:

$the_query = new WP_Query(array( 'category_name' => 'Recipe of the Week', 'offset' => 1 )

And then reference my new query object in the template like this:

<?php while ( $the_query-> have_posts() ) : $the_query->the_post(); ?>
share|improve this answer
add comment

'Recipe of the Week', 'posts_per_page' => -1, 'offset' => 1)); ?>

I think this might do it.. just testing.

share|improve this answer
1  
No, it didn't work :( –  John Hunt May 31 '11 at 2:18
    
This is not a "classic" forum. You can edit your existing answers to include new information. It is a bit confusing if you add multiple answers. I suggest you delete this answer and write everything in the other answer. –  Jan Fabry May 31 '11 at 7:02
    
seems to be indeed a weird behaviour; when i used a ridiculous large number, i.e. 'posts_per_page' => 9999 the offset worked. –  Michael May 31 '11 at 17:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.