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.

is there a quick and easy way to load all the posts, starting with the second post and making the first post the last post? If I use offset, I then lose the first post, but I don't want to lose it, I just want to change the sort order, ie. first becomes last and second becomes first post.

Thanks for your help.

share|improve this question
1  
Is this to work with pagination or not? And if so, does the first becomes last on each page, or does the first post of the first page become the very last post of the last page? –  Stephen Harris Aug 24 '12 at 10:53
    
pagination is not necessary, thanks –  uknowit2 Aug 25 '12 at 14:32

1 Answer 1

With pagination is easy :) -just retrieve all the posts, then skip the first one out. At the end rewind back to the beginning of the loop and output the post you missed out.

if( have_posts() ):

    while( have_posts() ): the_post();
         if( 0 == $wp_query->$current_post )
              continue;

         // Display all but the first post

    endwhile;

    //Rewind to the beginning
    rewind_posts();
    the_post();

    //Display first post

endif;
share|improve this answer

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.