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 +++++++++++--- single-angebote.php | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) 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' ) ); + } } ?> diff --git a/single-angebote.php b/single-angebote.php index 1182b5d..2b0bfb6 100644 --- a/single-angebote.php +++ b/single-angebote.php @@ -28,7 +28,7 @@ $container = get_theme_mod( 'understrap_container_type' ); - +