Displays the navigation to next/previous post, when applicable.
Parameters
$args
arrayoptional- See get_the_post_navigation() for available arguments.
More Arguments from get_the_post_navigation( … $args )
Default post navigation arguments.
prev_text
stringAnchor text to display in the previous post link.
Default'%title'
.next_text
stringAnchor text to display in the next post link.
Default'%title'
.in_same_term
boolWhether link should be in the same taxonomy term.
Default false.excluded_terms
int[]|stringArray or comma-separated list of excluded term IDs.
taxonomy
stringTaxonomy, if$in_same_term
is true. Default'category'
.screen_reader_text
stringScreen reader text for the nav element.
Default ‘Post navigation’.aria_label
stringARIA label text for the nav element. Default'Posts'
.class
stringCustom class for the nav element. Default'post-navigation'
.
Default:
array()
Source
function the_post_navigation( $args = array() ) {
echo get_the_post_navigation( $args );
}
Changelog
Version | Description |
---|---|
4.1.0 | Introduced. |
Customize your posts navigation to get posts in the same tag.
In order to include a header before the navigation and show it only when the navigation links exist: