Prepare the query before you loop over it:
$first = array_shift( $the_query->posts );
$second = array_shift( $the_query->posts );
// now re-add in reverse order
array_unshift( $the_query->posts, $first );
array_unshift( $the_query->posts, $second ); // this is now the first item
while ($the_query -> have_posts()) : $the_query -> the_post(); // regular loop
Related Posts:
- How to show related posts by category
- How to display posts by current user/author in a custom page template?
- How to get previous 10 days post from a specific date – WP Query
- Query only Posts from Both of Two Category?
- Order post by year DESC and month ASC
- WordPress get posts by date without query_posts
- Can I set and show “important” post in my blog?
- Inserting custom data to the_post() during loop
- Why is querying posts messing up my pages?
- Any way for get_next_post() to use the actual post order instead of publish order?
- Order posts alphabetically: how to set order=asc in mysql query?
- How to get posts from a current post’s month?
- Display Posts with template on a Page
- Post Filtering by GET URL parameters
- How to give classname to post if post has no content?
- Get posts from current category?
- How to merge the content of posts that have the same title?
- get posts, run a custom query, and join the results
- WP_Query to get posts in a specific tag or has post_format
- How to get all post titles starting with numbers and symbols?
- Word count for all posts of all authors
- Keep featured content post in homepage with original order
- Display all posts from specific categories on a page
- How do I reorder (pop and push) items from WP_Query?
- How to exclude latest x posts from a paginated query?
- How to put last edited entry on top of the blog-post list?
- Display content from a specific category
- Query posts from current year
- Reverse chronology of post listing
- Show the title of the latest post by author
- WordPress Posts Out Of Order after 3.1 Update
- Order Posts by Alphabetical for Each Letter
- Problem ordering posts with numbers for titles numerically E.g. 1, 10, 100
- Featured Posts for Category Pages
- Quickest way to get last or oldest post date – WP Query
- Cannot Update A Post, 404 Error
- Function to show random posts from a category
- Hiding posts in a list from specified categories
- Posts are not showing up on particular category
- get selected post using $_GET
- Change Order of Admin Posts Depending on Meta
- How would I get 1 latest post from a query for 5 posts?
- Create dropdown list post
- I would like to give special promotion for the first 100 posts in my blog? Can anyone tell me how to do that?
- get_next_post() and get_previous_post() return wrong posts
- Get posts by name and taxonomy term
- Get mixed category random posts
- WordPress not opening posts with only numbers if permalink is post_name
- Limit popular posts by days
- How can I sort posts by the date and a custom meta field?
- get_the_content(“more…”) returns full text
- Display all posts that were published before full post on single.php
- Two loops, one AJAX loop, exclude posts in first loop from second loop, loops are in different files
- Sort WP posts by span value
- How to sort posts inside categories
- Random ajax load only works with posts_per_page set to -1
- How to order posts by meta_value and title
- How to order posts in an arbitrary order?
- WordPress query_posts by tag doesn’t work anymore(?)
- Count number of posts of current month
- WordPress website loads more posts than expected
- Get the amount of posts on a current page
- query post limits
- why the same code got different results when using query_posts in functions.php and index.php
- How to get posts published on the latest date?
- Why posts array is empty?
- How to create a “latest news” page showing a list of posts from blog category
- How to check in functions.php if there is data in a WP_Query?
- WordPress query reverse order
- get_previous_post() while accounting for sticky posts
- Get post by tag
- Related Posts function not working
- All categories displays the same posts
- Query function not executed between element [closed]
- Echo the number of posts being displayed
- Exclude a category of posts in author template
- Display specific posts on home page
- If post does not exist, do something
- Order posts by date
- Move position in post list for a custom checkbox column
- How to mark only one post as Featured post?
- query posts with selected post ids first
- wp_query args with relation
- WP_Query sort by meta_value_num or date
- Use special template for the first post in the loop
- Allow reader to reorder posts for themselves (oldest first)
- How to get all posts in gallery post format template
- Repeating post how to solve this
- How to get the current user post and it’s ID?
- show latest authors blog post
- How to get only current images of a post
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Retrieve latest post by multiple categories with ID
- External link not showing on post but showing on comment
- wp_query select if have comments
- Creating pages and getting their values from the database table
- Last three posts not being put in order by date. How to fix this?
- Order by ‘s’ using WP_Query()
- get_posts includes “auto drafts”?
- NewsPaper WP Theme – Additional Related Posts Filter by Time (divTag composer)