max_num_pages <= 1 ) {
return;
}
$paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;
$max = intval( $wp_query->max_num_pages );
/** Add current page to the array */
if ( $paged >= 1 ) {
$links[] = $paged;
}
/** Add the pages around the current page to the array */
if ( $paged >= 3 ) {
$links[] = $paged - 1;
$links[] = $paged - 2;
}
if ( ( $paged + 2 ) <= $max ) {
$links[] = $paged + 2;
$links[] = $paged + 1;
}
echo '' . "\n";
}
endif;
/**
* The formatted output of a list of pages.
*
*/
add_action( 'reverie_page_links', 'reverie_page_links', 10, 1 );
/**
* Modification of wp_link_pages() for custom styling for foundation 2 & 3 by Zurb for use within wordpress.
*
* Please retain author links.
*
* @ author: Flickapix Dezign
* @ author url: http://dezign.flickapix.co.uk
* @ param array $args
* @ return void
*/
function bootredux_wp_page_links($args=array()) {
$defaults = array(
'before' => '',
'link_before' => ' ',
'link_after' => '',
'text_before' => '',
'text_after' => '',
'next_or_number' => 'number',
'nextpagelink' => __( 'Next page', 'bootredux' ),
'previouspagelink' => __( 'Previous page', 'bootredux' ),
'pagelink' => 'Page %',
'echo' => 1,
'current_first' => ' ',
'current_last' => '',
);
$r = wp_parse_args( $args, $defaults );
$r = apply_filters( 'wp_link_pages_args', $defaults );
extract( $r, EXTR_SKIP );
global $page, $numpages, $multipage, $more, $pagenow;
if ( ! $multipage )
{
return;
}
$output = $before;
for ( $i = 1; $i < ( $numpages + 1 ); $i++ )
{
$j = str_replace( '%', $i, $pagelink );
$output .= ' ';
if ( $i != $page || ( ! $more && 1 == $page ) )
{
$output .= _wp_link_page( $i ) . "{$link_before}{$j}{$link_after}";
}
else
{
$output .= "{$current_first}{$j}{$current_last}";
}
}
print $output . $after;
}