Nazrin Noorzan
asked 1 year ago

Need some help from woocommerce gurus here. As currently my site product pagination is display as PREVPAGE 1 2 3 .. 15 NEXTPAGE
May I know how I can make it as FIRSTPAGE PREVPAGE 12345 NEXTPAGE LASTPAGE ? I’m trying to achieve it same as https://www.tourneau.com/certified-pre-owned-watches/#sz=30&start=60
Can it be done just from woocommerce_pagination filter? Any insight?
This is the current code to display the pagination:

<nav class="pagination-cubic">
<?php woocommerce_result_count();?>
    <?php
        echo paginate_links( apply_filters( 'woocommerce_pagination_args', array(
            'base'         => esc_url_raw( str_replace( 999999999, '%#%', remove_query_arg( 'add-to-cart', get_pagenum_link( 999999999, false ) ) ) ),
            'format'       => '',
            'current'      => max( 1, get_query_var( 'paged' ) ),
            'total'        => $wp_query->max_num_pages,
            'prev_text'    => '<i class="fa fa-angle-left"></i>',
            'next_text'    => '<i class="fa fa-angle-right"></i>',
            'type'         => 'list',
            'end_size'     => 1,
            'mid_size'     => 4
        ) ) );
    ?>
</nav>
1 Answers
DominicStaff
answered 1 year ago

You can download this free WordPress Pagination plugin at: WordPress.org’s Plugin Repository – WP-PageNavi.
Step 1: You should download and install WP-PageNavi into your WordPress plugins directory and then activate the plugin in your WordPress Dashboard.   Step 2: Once it is installed, you can set up the options using the settings page for this plugin in your WordPress Dashboard.   Step 3: After you have the settings set up, add this code below to your current theme’s Functions.php file to have WP-PageNavi’s pagination replace WooCommerce’s default page navigation    

/**
 * Replace WooCommerce Default Pagination with WP-PageNavi Pagination
 *
 */
remove_action('woocommerce_pagination', 'woocommerce_pagination', 10);
function woocommerce_pagination() {
		wp_pagenavi(); 		
	}
add_action( 'woocommerce_pagination', 'woocommerce_pagination', 10);
Powered by DW Question & Answer Pro