Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Pagination
- *
- * @return html
- * @since v1.02
- */
- function keha76_pagination( $args = array() ) {
- global $wp_query;
- $current = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
- if ( get_option('permalink_structure') ) {
- $format = 'page/%#%';
- } else {
- $format = '?paged=%#%';
- if ( !is_home() ) {
- $format = '&paged=%#%';
- }
- }
- if ( $wp_query->max_num_pages > 1 ) {
- $defaults = array(
- 'base' => get_pagenum_link( 1 ) . '%_%',
- 'format' => $format,
- 'total' => $wp_query->max_num_pages,
- 'current' => $current,
- 'show_all' => false,
- 'end_size' => 2,
- 'mid_size' => 0,
- 'prev_next' => true,
- 'prev_text' => __( '« Newer', 'keha76-blank' ),
- 'next_text' => __( 'Older »', 'keha76-blank' ),
- 'type' => 'plain',
- 'add_args' => false,
- 'add_fragment' => ''
- );
- $args = wp_parse_args( $args, apply_filters( 'keha76_paginate_links', $defaults ) );
- echo paginate_links( $args );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement