Add support for non-archive pages

By relaxing the exit condition understrap_pagination() may be used in custom loops. See #1054 for an how to example.
This commit is contained in:
IanDelMar 2019-12-14 12:00:39 +01:00
parent 2f752095a6
commit ecda11ac10
1 changed files with 4 additions and 1 deletions

View File

@ -12,7 +12,7 @@ if ( ! function_exists( 'understrap_pagination' ) ) {
function understrap_pagination( $args = array(), $class = 'pagination' ) { function understrap_pagination( $args = array(), $class = 'pagination' ) {
if ( $GLOBALS['wp_query']->max_num_pages <= 1 ) { if ( ! isset( $args['total'] ) && $GLOBALS['wp_query']->max_num_pages <= 1 ) {
return; return;
} }
@ -30,6 +30,9 @@ if ( ! function_exists( 'understrap_pagination' ) ) {
); );
$links = paginate_links( $args ); $links = paginate_links( $args );
if ( ! $links ) {
return;
}
?> ?>