Choose from any of the following functions:
get_next_post_link();
next_post_link();
get_previous_post_link();
previous_post_link();
Parameters are as follows (in respective order):
@param
string
$format
Optional. Link anchor format. Default '« %link'.
@param
string
$link
Optional. Link permalink format. Default '%title'.
@param
bool
$in_same_term
Optional. Whether link should be in a same taxonomy term. Default false
.
@param
array|string
$excluded_terms
Optional. Array
or comma-separated list of excluded term IDs. Default empty
.
@param
string
$taxonomy
Optional. Taxonomy, if $in_same_term
is true
. Default 'category'.
@return
string
The link URL of the next post in relation to the
current post.
Optionally, you could do more with your pagination if you opted for more labor. You could use get_next_post();
or get_previous_post();
These two functions would allow you to retrieve the entire next/previous post object. You could then retrieve post meta, featured image, post format, post excerpt, etc.
Parameters are as follows (in respective order):
@param
bool
$in_same_term
Optional. Whether post should be in a same taxonomy term. Default false
.
@param
array|string
$excluded_terms
Optional. Array
or comma-separated list of excluded term IDs. Default empty
.
@param
string
$taxonomy
Optional. Taxonomy, if $in_same_term
is true
. Default 'category'.
@return
null|string|WP_Post
Post object
if successful. Null
if
global $post
is not set. Empty
string
if no corresponding post
exists.
All of this (and more) can be found in ./wp-includes/link-template.php
query_posts
or a customWP_Query
to display your posts?