diff --git a/inc/extras.php b/inc/extras.php index 4ca1f82..16c8882 100644 --- a/inc/extras.php +++ b/inc/extras.php @@ -74,3 +74,40 @@ if ( ! function_exists( 'change_logo_class' ) ) { return $html; } } + +/** + * Display navigation to next/previous post when applicable. + */ +if ( ! function_exists( 'understrap_post_nav' ) ) : + + function understrap_post_nav() { + // 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 ); + + if ( ! $next && ! $previous ) { + return; + } + ?> + +
+
+ +
+
+