|
|
|
@ -7,55 +7,63 @@
|
|
|
|
|
* @package _s
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if ( ! function_exists( '_s_content_nav' ) ) :
|
|
|
|
|
if ( ! function_exists( '_s_paging_nav' ) ) :
|
|
|
|
|
/**
|
|
|
|
|
* Display navigation to next/previous pages when applicable.
|
|
|
|
|
* Display navigation to next/previous set of posts when applicable.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
function _s_content_nav( $nav_id ) {
|
|
|
|
|
global $wp_query, $post;
|
|
|
|
|
|
|
|
|
|
// Don't print empty markup on single pages if there's nowhere to navigate.
|
|
|
|
|
if ( is_single() ) {
|
|
|
|
|
$previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true );
|
|
|
|
|
$next = get_adjacent_post( false, '', false );
|
|
|
|
|
|
|
|
|
|
if ( ! $next && ! $previous ) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Don't print empty markup in archives if there's only one page.
|
|
|
|
|
if ( $wp_query->max_num_pages < 2 && ( is_home() || is_archive() || is_search() ) ) {
|
|
|
|
|
function _s_paging_nav() {
|
|
|
|
|
// Don't print empty markup if there's only one page.
|
|
|
|
|
if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$nav_class = ( is_single() ) ? 'post-navigation' : 'paging-navigation';
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
<nav role="navigation" id="<?php echo esc_attr( $nav_id ); ?>" class="<?php echo $nav_class; ?>">
|
|
|
|
|
<h1 class="screen-reader-text"><?php _e( 'Post navigation', '_s' ); ?></h1>
|
|
|
|
|
<nav class="navigation paging-navigation" role="navigation">
|
|
|
|
|
<h1 class="screen-reader-text"><?php _e( 'Posts navigation', '_s' ); ?></h1>
|
|
|
|
|
<div class="nav-links">
|
|
|
|
|
|
|
|
|
|
<?php if ( is_single() ) : // navigation links for single posts ?>
|
|
|
|
|
<?php if ( get_next_posts_link() ) : ?>
|
|
|
|
|
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', '_s' ) ); ?></div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
<?php previous_post_link( '<div class="nav-previous">%link</div>', '<span class="meta-nav">' . _x( '←', 'Previous post link', '_s' ) . '</span> %title' ); ?>
|
|
|
|
|
<?php next_post_link( '<div class="nav-next">%link</div>', '%title <span class="meta-nav">' . _x( '→', 'Next post link', '_s' ) . '</span>' ); ?>
|
|
|
|
|
<?php if ( get_previous_posts_link() ) : ?>
|
|
|
|
|
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', '_s' ) ); ?></div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
<?php elseif ( $wp_query->max_num_pages > 1 && ( is_home() || is_archive() || is_search() ) ) : // navigation links for home, archive, and search pages ?>
|
|
|
|
|
|
|
|
|
|
<?php if ( get_next_posts_link() ) : ?>
|
|
|
|
|
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', '_s' ) ); ?></div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
<?php if ( get_previous_posts_link() ) : ?>
|
|
|
|
|
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', '_s' ) ); ?></div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
</nav><!-- #<?php echo esc_html( $nav_id ); ?> -->
|
|
|
|
|
</div><!-- .nav-links -->
|
|
|
|
|
</nav><!-- .navigation -->
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
endif; // _s_content_nav
|
|
|
|
|
endif;
|
|
|
|
|
|
|
|
|
|
if ( ! function_exists( '_s_post_nav' ) ) :
|
|
|
|
|
/**
|
|
|
|
|
* Display navigation to next/previous post when applicable.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
function _s_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;
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
<nav class="navigation post-navigation" role="navigation">
|
|
|
|
|
<h1 class="screen-reader-text"><?php _e( 'Post navigation', '_s' ); ?></h1>
|
|
|
|
|
<div class="nav-links">
|
|
|
|
|
|
|
|
|
|
<?php previous_post_link( '%link', _x( '<span class="meta-nav">←</span> %title', 'Previous post link', '_s' ) ); ?>
|
|
|
|
|
<?php next_post_link( '%link', _x( '%title <span class="meta-nav">→</span>', 'Next post link', '_s' ) ); ?>
|
|
|
|
|
|
|
|
|
|
</div><!-- .nav-links -->
|
|
|
|
|
</nav><!-- .navigation -->
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
endif;
|
|
|
|
|
|
|
|
|
|
if ( ! function_exists( '_s_comment' ) ) :
|
|
|
|
|
/**
|
|
|
|
|