Use core navigation template tags.

* Remove custom arguments from `the_posts_navigation()` and `the_post_navigation()`.
* Adjust fallbacks for `the_posts_navigation()` and `the_post_navigation()`.
* update pot file.
* merge master for style.css and style.scss.
This commit is contained in:
Kazue Igarashi 2014-12-19 10:34:18 +09:00 committed by Konstantin Obenland
parent 5c6311499b
commit 894bd6b5d3
9 changed files with 68 additions and 75 deletions

View file

@ -7,26 +7,28 @@
* @package _s
*/
if ( ! function_exists( '_s_paging_nav' ) ) :
if ( ! function_exists( 'the_posts_navigation' ) ) :
/**
* Display navigation to next/previous set of posts when applicable.
*
* @todo Remove this function when WordPress 4.3 is released.
*/
function _s_paging_nav() {
function the_posts_navigation() {
// Don't print empty markup if there's only one page.
if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
return;
}
?>
<nav class="navigation paging-navigation" role="navigation">
<h1 class="screen-reader-text"><?php _e( 'Posts navigation', '_s' ); ?></h1>
<nav class="navigation posts-navigation" role="navigation">
<h2 class="screen-reader-text"><?php _e( 'Posts navigation', '_s' ); ?></h2>
<div class="nav-links">
<?php if ( get_next_posts_link() ) : ?>
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', '_s' ) ); ?></div>
<div class="nav-previous"><?php next_posts_link( __( '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">&rarr;</span>', '_s' ) ); ?></div>
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts', '_s' ) ); ?></div>
<?php endif; ?>
</div><!-- .nav-links -->
@ -35,11 +37,13 @@ function _s_paging_nav() {
}
endif;
if ( ! function_exists( '_s_post_nav' ) ) :
if ( ! function_exists( 'the_post_navigation' ) ) :
/**
* Display navigation to next/previous post when applicable.
*
* @todo Remove this function when WordPress 4.3 is released.
*/
function _s_post_nav() {
function the_post_navigation() {
// 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 );
@ -49,11 +53,11 @@ function _s_post_nav() {
}
?>
<nav class="navigation post-navigation" role="navigation">
<h1 class="screen-reader-text"><?php _e( 'Post navigation', '_s' ); ?></h1>
<h2 class="screen-reader-text"><?php _e( 'Post navigation', '_s' ); ?></h2>
<div class="nav-links">
<?php
previous_post_link( '<div class="nav-previous">%link</div>', _x( '<span class="meta-nav">&larr;</span>&nbsp;%title', 'Previous post link', '_s' ) );
next_post_link( '<div class="nav-next">%link</div>', _x( '%title&nbsp;<span class="meta-nav">&rarr;</span>', 'Next post link', '_s' ) );
previous_post_link( '<div class="nav-previous">%link</div>', '%title' );
next_post_link( '<div class="nav-next">%link</div>', '%title' );
?>
</div><!-- .nav-links -->
</nav><!-- .navigation -->