Skip to content

Instantly share code, notes, and snippets.

@patrickposner
Last active July 24, 2018 09:35
Show Gist options
  • Select an option

  • Save patrickposner/bb83d3537c96080ef05fa9a14520f3c8 to your computer and use it in GitHub Desktop.

Select an option

Save patrickposner/bb83d3537c96080ef05fa9a14520f3c8 to your computer and use it in GitHub Desktop.
function atomion_get_posts_pagination( Array $args = array() ) {
global $wp_query;
$paginated = $wp_query->max_num_pages;
if ( $paginated < 2 )
return '';
$default_args = array(
'base' => str_replace( 999999999, '%#%', get_pagenum_link( 999999999 ) ),
'current' => max( 1, get_query_var( 'paged' ) ),
'format' => '',
'mid_size' => 2,
'total' => $wp_query->max_num_pages,
'type' => 'list',
'prev_text' => sprintf(
'<span title="%s">&lsaquo;</span>',
__( 'Previous', 'muenchen' )
),
'next_text' => sprintf(
'<span title="%s">&rsaquo;</span>',
__( 'Next', 'muenchen' )
),
);
$args = wp_parse_args( $args, $default_args );
$output = paginate_links( $args );
echo $output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment