Support » Fixing WordPress » Finding the Next Post in a WP_Query in Single.php
3 years, 11 months ago
So basically I want to find out the post that’s after the post that I am currently on by using the creation date.
Possibly through WP_Query using the following arguments
// Find connected posts
$episodesAnime = new WP_Query( array(
'connected_type' => 'posts_to_anime',
'connected_items' => get_queried_object(),
'nopaging' => true,
'order-by' => 'date',
'order' => ASC,
With a while loop I can get all the posts that I want. Now I want to make it so it only shows the posts that are ahead and behind the actual post that the user is currently on.
Any sort of help or direction would be appreciated.
Try it with these functions:
All of these look for a category to restrict their search, I want the aforementioned query to restrict my search.
“connected_type” or “connected_items” are not built-in parameters:
Do you use a plugin for these parameters? If so, post in the dedicated forum for that plugin.