You don’t need separate queries, you can run multiple loops on the same query-
// output first post
if( have_posts() ){
the_post();
the_title();
}
// output the rest of the posts...
if( have_posts() ){
while( have_posts() ){
the_post();
the_title();
}
}
You can also use rewind_posts()
to reset the current post back to 0, as well as manually set $wp_query->current_post
to whatever index you want and start the loop there (note: the post counter starts at 0, not 1).
If you only want to style the first post on the first page and not subsequent pages, you can check if it’s not paged with ! is_paged()
if( ! is_paged() ){
echo 'this will only output on the first page';
if( have_posts() ){
the_post();
the_title();
}
}
Related Posts:
- How to fix pagination for custom loops?
- Remove the Homepage Query
- Is `query_posts` really slower than secondary query?
- Are there any scenarios where the query_posts may be used?
- Transient not working for custom loops
- post loop causes wp_users and wp_usermeta DB queries for each users
- get_the_foo() in the loop – does it perform another query?
- If No Search Results, Show Posts from Alternate Search Query
- How to Loop within a Loop (Display Children and then Grandchildren)
- Loop after page content
- A loop with all articles with certain text strings in tags
- Display most viewed post from last 30 days is not working correctly
- Query posts if meta key starts with
- 3 Posts in Loop, Show Stickies First
- How to go about combining dropdowns / filter queries?
- Query reset problem or flawed code to enable custom post type query
- Query last updated posts (posts updated in the last 24 hours)
- Conditional query that displays on Woo product attribute pages
- How do I use AJAX Query in my posts loop?
- woocommerce get_price_html not pulling in correct price
- How to fix pagination for custom loops?
- How can I paginate this?
- How to display posts by vote count and if no value continue with latest posts with no votes?
- How to fix pagination for custom loops?
- Split wordpress loop to multiple layouts
- Making a query to the DB using same parameters of loop
- Loop inside query
- get_delete_post_link() inside Loop stubbornly returns nothing
- loop inside the foreach
- Query posts only with actual text content (not including shortcode or images)
- Exclude posts based on an array
- Query post & loop problem.
- Loops for cat links not looping for wordpress site
- How do I set the Stewart Search Template to return only published posts in the result
- Trying to get all links in my posts
- Custom Query with Sticky Posts
- Build a Page which shows the Oldest Post with specific Custom Field Value
- Query posts and display all dates in repeater field in chronological order
- How to fix pagination for custom loops?
- Get featured image outside the loop using foreach
- Alternative layout the loop
- Show posts by tags excluding current post
- Strange problem with wp_get_attachment_image_src database (db) query count
- Next 10 posts data of currently viewing post in blog page
- How to fix pagination for custom loops?
- How to fix pagination for custom loops?
- How to fix pagination for custom loops?
- Get query result before posts are displayed?
- Combine Query and Select Database to create directory loop
- WordPress loop: Display if posts exist
- wordpress showing all posts instead of date range
- Multiple loop with pagination in same page
- Query Loop Block: possible to restrict just child pages?
- Use Base-URL with Query-Loop
- Counting the posts of a custom WordPress loop (WP_Query)?
- Pagination not working with custom loop
- Get post content from outside the loop
- Is there any difference between the_title() and echo get_the_title()?
- Pagination not working on home page
- is_home, and is_front_page conditional problem
- Looping through posts per category gives same posts for each category
- WordPress Loop Through Particular Pages
- Transient pagination not working properly
- Display date only once for a each set of posts relating to that date
- Chopping up a large ajax request of around 200 posts [closed]
- Combining the_excerpt with the_content
- Better way to display posts from specific categories, in a grid layout
- Infinite Redirect Loop after moving to subdirectory
- WordPress Loop – Not returning projects in specific category
- Next and Previous loop
- Exclude posts from main loop based on meta value
- trouble calling an import class from an action in a plugin before wp_cron executes
- How can I load posts starting from, and including, the current post?
- ‘Auto Draft’ Post showing in wordpress loop
- How do I display an image before the first post of the loop when I’m using get_template_part?
- Multiple get_posts() queries on one page
- In Custom page – next_posts_link Not working while previous_posts_link is working
- Escape current post from loop
- Why isn’t my multiple loops working?
- How do I display the latest posts from three different categories?
- facebook like, tweet and google+1 buttons inside the loop on home, archive and search pages and missing facebook like buttons
- How to print redux gallery feilds id? [closed]
- Why the first with flexslider appears as blank on my code?
- Rendering pages
- How can have a conditional template tag based on the main loop within a secondary loop with new WP_Query(), using get_template_part()
- WP_Query is only looping home page, not pages
- How to filter posts by category INSIDE the loop
- Shortcode with loop stacks output
- Adding a second loop breaks everything
- is it bad to copy the loop for a template?
- I want to load post in bootstrap Modal dynamically
- Return only one post format in index.php [duplicate]
- How to execute custom loop before loop content?
- Return only content in excerpt field in loop
- Buddypress Group Activity Loop Filter activity type [closed]
- get_posts and wp_autop (remove filter)
- Trouble preventing duplicate posts between 2 loops on homepage
- Pagination not working with custom loop
- wp_mail function not working in user query loop
- How to set and retrieve cookies while in the loop