Created
July 12, 2015 17:36
-
-
Save skipshean/910d6fa0a3e202568bd5 to your computer and use it in GitHub Desktop.
Template-Tags from bootstrapwp font awesome section
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( ! function_exists( 'bswp_posts_navigation' ) ) : | |
/** | |
* Display navigation to next/previous set of posts when applicable. | |
* | |
* @todo Remove this function when WordPress 4.3 is released. | |
*/ | |
function bswp_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="sr-only"><?php _e( 'Posts navigation', 'bootstrapwp' ); ?></h1> | |
<ul class="pager"> | |
<?php if ( get_next_posts_link() ) : ?> | |
<li class="previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'bootstrapwp' ) ); ?></li> | |
<?php endif; ?> | |
<?php if ( get_previous_posts_link() ) : ?> | |
<li class="next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'bootstrapwp' ) ); ?></li> | |
<?php endif; ?> | |
</ul><!-- .nav-links --> | |
</nav><!-- .navigation --> | |
<?php | |
} | |
endif; | |
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 bootstrapwp_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="sr-only"><?php _e( 'Post navigation', 'bootstrapwp' ); ?></h1> | |
<ul class="pager"> | |
<?php | |
previous_post_link( '<li class="previous">%link</li>', _x( '<span class="meta-nav">←</span> %title', 'Previous post link', 'bootstrapwp' ) ); | |
next_post_link( '<li class="next">%link</li>', _x( '%title <span class="meta-nav">→</span>', 'Next post link', 'bootstrapwp' ) ); | |
?> | |
</ul><!-- .nav-links --> | |
</nav><!-- .navigation --> | |
<?php | |
} | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment