Displays the next post link that is adjacent to the current post.
Description
See also
Parameters
$format
stringoptional- Link anchor format. Default ‘« %link’.
Default:
'%link »'
$link
stringoptional- Link permalink format. Default
'%title'
.Default:
'%title'
$in_same_term
booloptional- Whether link should be in the same taxonomy term.
Default:
false
$excluded_terms
int[]|stringoptional- Array or comma-separated list of excluded term IDs.
Default:
''
$taxonomy
stringoptional- Taxonomy, if
$in_same_term
is true. Default'category'
.Default:
'category'
Source
function next_post_link( $format = '%link »', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
echo get_next_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy );
}
Changelog
Version | Description |
---|---|
1.5.0 | Introduced. |
Hola, If you use the Bootstrap, you will encounter a problem in not being able to modify the class (a),
These are in the single.php file :
This is in the functions.php file :
I used FontAwesome for the icons that you can change as you like
Bold Post Title As Link
Displays link with next chronological post’s title wrapped in ‘strong’ tags (“My Next Post Title”).
Within Same Category, Excluding One
Displays link to next post in the same category, as long as it is not in category 13 (the category ID #). You can change the number to any category you wish to exclude. Exclude multiple categories by using ” and ” as a delimiter.
Within Same Custom Taxonomy
Displays link to next post in the same custom taxonomy term.
Replace Next/Previous Post Text
Changes the default ‘« %link’ format to just the post title, removing the default double arrows.
Can replace
%title
with alternative text.Note
See
previous_post_link()
.Example: Default Usage
Displays link to the next post (chronologically by publish date) with the post title as the link text, followed by a right angle quote (“My Next Post Title »”).
If there is no next post, the function does not print anything.
Text As Link, Without Post Title, Within Same Category
Displays custom text as link to the next post within the same category as the current post. Post title is not included here. “Next post in category” is the custom text in this example.
Usage