Skip to content

Commit

Permalink
improve navigation, clean up templates
Browse files Browse the repository at this point in the history
  • Loading branch information
SilentComics committed Mar 17, 2017
1 parent 5add7fb commit 9edeb84
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
10 changes: 8 additions & 2 deletions archive.php
Expand Up @@ -85,7 +85,9 @@
// Show an optional term description.
$term_description = term_description();
if ( ! empty( $term_description ) ) :
'<div class="taxonomy-description"' . printf( esc_html( '%s', $term_description, 'strip' ) ) . '</div>';
echo '<div class="taxonomy-description">';
echo term_description();
echo '</div>';
endif;
?>
</div><!-- .wrap -->
Expand All @@ -106,7 +108,11 @@

<?php endwhile; ?>

<?php strip_content_nav( 'nav-below' ); ?>
<?php the_posts_pagination( array(
'prev_text' => _x( '&#8592;', 'Previous page link', 'strip' ) . '<span class="screen-reader-text">' . __( 'Previous page', 'strip' ) . '</span>',
'next_text' => '<span class="screen-reader-text">' . __( 'Next page', 'strip' ) . '</span>' . _x( '&#8594;', 'Next post link', 'strip' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'strip' ) . ' </span>',
) ); ?>

<?php else : ?>

Expand Down
18 changes: 1 addition & 17 deletions inc/template-tags.php
Expand Up @@ -28,14 +28,8 @@ function strip_header_background() {
* @param $string $nav_id strip_content_nav.
*/
function strip_content_nav( $nav_id ) {
global $wp_query;
// Don't print empty markup on single pages if there's nowhere to navigate.
// 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() ) ) {
return;
}

$nav_class = ( is_single() || is_tax( 'story' ) ) ? 'post-navigation' : 'paging-navigation' ;
$nav_class = ( is_single() || is_post_type( 'comic' ) ) ? 'post-navigation' : 'paging-navigation' ;

?> <div class="wrap clear">

Expand All @@ -59,16 +53,6 @@ function strip_content_nav( $nav_id ) {
<?php previous_post_link( '<div class="nav-previous">%link</div>', '<span class="meta-nav">' . _x( '&#8592;', 'Previous post link', 'strip' ) . '</span> %title' ); ?>
<?php next_post_link( '<div class="nav-next">%link</div>', '%title <span class="meta-nav">' . _x( '&#8594;', 'Next post link', 'strip' ) . '</span>' ); ?>

<?php elseif ( $wp_query->max_num_pages > 1 && ( is_home() || is_archive() || is_search() ) ) : // navigation links for blog, archive, and search pages. ?>

<?php if ( get_next_posts_link() ) : ?>
<div class="nav-previous-page"><?php next_posts_link( __( 'Older posts', 'strip' ) ); ?></div>
<?php endif; ?>

<?php if ( get_previous_posts_link() ) : ?>
<div class="nav-next-page"><?php previous_posts_link( __( 'Recent posts', 'strip' ) ); ?></div>
<?php endif; ?>

<?php endif; ?>

</div><!-- .entry-wrap -->
Expand Down
8 changes: 7 additions & 1 deletion index.php
Expand Up @@ -36,7 +36,13 @@

<?php endwhile; ?>

<?php strip_content_nav( 'nav-below' ); ?>
<div class="wrap">
<?php the_posts_pagination( array(
'prev_text' => _x( '&#8592;', 'Previous page link', 'strip' ) . '<span class="screen-reader-text">' . __( 'Previous page', 'strip' ) . '</span>',
'next_text' => '<span class="screen-reader-text">' . __( 'Next page', 'strip' ) . '</span>' . _x( '&#8594;', 'Next post link', 'strip' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'strip' ) . ' </span>',
) ); ?>
</div>

<?php else : ?>

Expand Down
6 changes: 5 additions & 1 deletion search.php
Expand Up @@ -25,7 +25,11 @@

endwhile;

strip_content_nav( 'nav-below' );
the_posts_pagination( array(
'prev_text' => _x( '&#8592;', 'Previous page link', 'strip' ) . '<span class="screen-reader-text">' . __( 'Previous page', 'strip' ) . '</span>',
'next_text' => '<span class="screen-reader-text">' . __( 'Next page', 'strip' ) . '</span>' . _x( '&#8594;', 'Next post link', 'strip' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'strip' ) . ' </span>',
) );

else : ?>

Expand Down

0 comments on commit 9edeb84

Please sign in to comment.