This will get you next 10 posts on single post template.
<?php
global $post;
$current_post = $post;
for ( $i = 1; $i <= 10; $i++ ) {
$post = get_previous_post(); // this uses $post->ID
setup_postdata($post);
get_template_part( 'content', get_post_format() );
}
$post = $current_post; // restore
?>
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 posts only excluding first post
- 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
- 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
- How to split a loop into multiple columns
- Is it necessary to reset the query after using get_posts()?
- Get post by page name or slug
- save_post + insert_post = infinite loop
- Get ID of a page containing secondary loop in content
- ACF Repeater loops and resets – where is the reset_rows() documentation? [closed]
- What is best way passing variables to theme templates and using them different places like widgets?
- Apply styling only to first page sticky posts
- Load comments per post on click with AJAX
- The main Loop is not starting in a custom blog template page
- connect last post with first post
- taxonomy tags 404 to custom post types
- Breaking the loop?
- woocommerce stored variable
- A smarter way to display multiple loops inside a page template
- How to print out menu names in the foreach loop?
- How do I style the first two posts of a loop
- How to get the role id from the role name?
- How do I paginate a get_posts() request inside another page loop (Paginating childpages)
- Include current post into loop
- How to create a multidimensional array with multiple loops
- How to create custom popup in shop page on every loop products?
- Getting posts link in WordPress
- Loop through an array inside a class using foreach [closed]
- using wp_get_attachment_image_src in foreach loop
- How to separate posts loop in to two columns? [duplicate]
- query_posts clarification needed
- “the_excerpt” in loop just keeps repeating first post?
- wpdb inside foreach loop only returns first result – 2 other similar cases found [closed]
- Using jQuery .after inside loop
- Add 2 values to post__not_in
- How to loop specific Category menu from archive page?
- How can I pass additional params to a shortcode while in a loop?
- Add all category as classes in foreach loop
- Exclude posts from loop by term
- How to avoid appending “null” in Ajax?
- Advanced Post Display/Pagination/Ordering
- Adding pagination to WP_Query [duplicate]
- Insert/sticky multiple posts in multiple positions
- This webpage has a redirect loop issue with SSL page
- Stuck with conflicting loops on page template
- Show amount of posts created today above loop?
- How to create WordPress loop with combination of 4 and 2 columns twitter-bootstrap?
- How to add custom HTML markup and classes to the_content()?
- $do_not_duplicate is not working in genesis theme
- Loop displays current page