wp_pagenavi function parameters [closed]

Why do you dont use the default functions from WP.
As example the follow class, there you can use.

class fb_pagination_example {

    public function content_nav( $nav_id, $pag_bar = TRUE ) {

        if ( $GLOBALS['wp_query'] -> max_num_pages > 1 ) : ?>
            <nav id="<?php echo $nav_id; ?>">
                <h1 class="assistive-text"><?php _e( 'Post navigation', WP_BASIS_TXTD ); ?></h1>
                <?php 
                if ( $pag_bar ) {
                    self :: get_paginate_bar();
                } else { ?>
                    <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', WP_BASIS_TXTD ) ); ?></div>
                    <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', WP_BASIS_TXTD ) ); ?></div>
                <?php } ?>
            </nav>
        <?php endif;
    }

    public function get_paginate_bar( $args = FALSE ) {
        global $wp_rewrite, $wp_query;

        $wp_query -> query_vars['paged'] > 1 ? $current = $wp_query -> query_vars['paged'] : $current = 1;
        if ( empty($rules) ) {
            $rulestouse = @add_query_arg( 'paged','%#%' );
        } else {
            $rulestouse = @add_query_arg( 'page','%#%' );
        }

        if ( ! $args ) {
            $args = array(
                'base'         => $rulestouse,
                'format'       => '',
                'total'        => $wp_query -> max_num_pages,
                'current'      => $current,
                'show_all'     => TRUE,
                'prev_next'    => TRUE,
                'prev_text'    => __( '« Previous', WP_BASIS_TXTD ),
                'next_text'    => __( 'Next »', WP_BASIS_TXTD ),
                'end_size'     => 1,
                'mid_size'     => 2,
                'type'         => 'plain',
                'add_args'     => false, // array of query args to add
                'add_fragment' => '',
                'show_total'   => TRUE,
                'display'      => TRUE
            );
        }

        if ( $wp_rewrite -> using_permalinks() ) {
            $args['base'] = user_trailingslashit( 
                trailingslashit( remove_query_arg( 's', get_pagenum_link(1) ) ) . 'page/%#%/', 'paged' );
        }
        if ( ! empty( $wp_query -> query_vars['s'] ) ) {
            $args['add_args'] = array( 's' => get_query_var('s') );
        }

        $pagination = paginate_links( $args );

        if ( $args['show_total'] )
            $pagination .= __( ' (', WP_BASIS_TXTD ) . $wp_query -> max_num_pages . __( ')', WP_BASIS_TXTD );

        if ( $args['display'] )
            echo $pagination;
        else
            return $pagination;
    }

}

Leave a Comment