• 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.

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Finding the Next Post in a WP_Query in Single.php’ is closed to new replies.