Make pagination show -in between-numbers

This topic has 5 replies, 3 voices, and was last updated 1 years, 11 months ago ago by Jose alfonso

  • Avatar: Jose alfonso
    Jose alfonso
    Participant
    May 13, 2022 at 21:41

    I have this pagination style but even though there are only 4 pages.. it hides the number “3”, I dont want this to hapen, where may I change this?

    4 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 14, 2022 at 13:46

    Hello,

    There is no such option, by default.

    Regards

    Avatar: Jose alfonso
    Jose alfonso
    Participant
    May 16, 2022 at 03:25

    Ok then, could you tell me please in which PHP file or template part is this behavior programmed?

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    May 16, 2022 at 12:39

    Hello,

    Add the below function to your child theme functions.php

    function et_woocommerce_pagination() {
    		
    	$args = array(
    		'total'   => wc_get_loop_prop( 'total_pages' ),
    		'current' => wc_get_loop_prop( 'current_page' ),
    		'base'    => esc_url_raw( add_query_arg( 'product-page', '%#%', false ) ),
    		'format'  => '?product-page=%#%',
    	);
    	
    	// @todo make push ajax loaded styles/scripts in footer and prevent load next times
    	etheme_enqueue_style( 'pagination', isset($_GET['et_ajax']));
    	
    	$format = isset( $format ) ? $format : '';
    	$base   = esc_url_raw( add_query_arg( 'product-page', '%#%', false ) );
    	
    	if ( ! wc_get_loop_prop( 'is_shortcode' ) ) {
    		$format = '';
    		$base   = esc_url_raw( str_replace( 999999999, '%#%', remove_query_arg( 'add-to-cart', wp_specialchars_decode( get_pagenum_link( 999999999 ) ) ) ) );
    	}
    	
    	$total   = isset( $total ) ? $total : wc_get_loop_prop( 'total_pages' );
    	$current = isset( $current ) ? $current : wc_get_loop_prop( 'current_page' );
    
    //		$et_per_page  = ( isset( $_REQUEST['et_per_page'] ) ) ? $_REQUEST['et_per_page'] : etheme_get_option( 'products_per_page', 12 );
    	$selected_val = ( isset( $_GET['et_per_page'] ) ) ? $_GET['et_per_page'] : false;
    	
    	return array(
    		'base'      => $base,
    		'format'    => $format,
    		'add_args'  => ( ( ! wc_get_loop_prop( 'is_shortcode' ) && $selected_val ) ? array( 'et_per_page' => $selected_val ) : false ),
    		'current'   => max( 1, $current ),
    		'total'     => $total,
    		'prev_text' => '<i class="et-icon et-'.(is_rtl() ? 'right' : 'left').'-arrow"><span class="screen-reader-text hidden">'.esc_html__('prev', 'xstore').'</span></i>',
    		'next_text' => '<i class="et-icon et-'.(is_rtl() ? 'left' : 'right').'-arrow"><span class="screen-reader-text hidden">'.esc_html__('next', 'xstore').'</span></i>',
    		'type'      => 'list',
    		'end_size'  => 1,
    		'mid_size'  => 1,
    	);
    }

    and change the

    'end_size'  => 1,
    'mid_size'  => 1,

    according to your needs.

    Regards

    Avatar: Jose alfonso
    Jose alfonso
    Participant
    May 16, 2022 at 18:26

    Thanks for that! It solves the problem.

  • Viewing 5 results - 1 through 5 (of 5 total)

The issue related to '‘Make pagination show -in between-numbers’' has been successfully resolved, and the topic is now closed for further responses

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.