From af937d3250f423005eace057e3125f177a511fc1 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 6 Mar 2019 19:15:01 +0100 Subject: Pagination can be limited to current taxonomy. --- inc/extras.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'inc') diff --git a/inc/extras.php b/inc/extras.php index 94f7485..4ad648c 100644 --- a/inc/extras.php +++ b/inc/extras.php @@ -85,7 +85,7 @@ if ( ! function_exists( 'understrap_change_logo_class' ) ) { */ if ( ! function_exists ( 'understrap_post_nav' ) ) { - function understrap_post_nav() { + function understrap_post_nav($taxonomy = '') { // Don't print empty markup if there's nowhere to navigate. $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); @@ -100,10 +100,18 @@ if ( ! function_exists ( 'understrap_post_nav' ) ) { %link', _x( ' %title', 'Previous post link', 'understrap' ) ); + if ( '' != $taxonomy ) { + previous_post_link( '%link', _x( ' %title', 'Previous post link', 'understrap' ), true, '', $taxonomy ); + } else { + previous_post_link( '%link', _x( ' %title', 'Previous post link', 'understrap' ) ); + } } if ( get_next_post_link() ) { - next_post_link( '%link', _x( '%title ', 'Next post link', 'understrap' ) ); + if ( '' != $taxonomy ) { + next_post_link( '%link', _x( '%title ', 'Next post link', 'understrap' ), true, '', $taxonomy ); + } else { + next_post_link( '%link', _x( '%title ', 'Next post link', 'understrap' ) ); + } } ?> -- cgit v1.2.3