Home › Forums › WoodMart support forum › pagination with query string in woocomerce
pagination with query string in woocomerce
- This topic has 3 replies, 3 voices, and was last updated 3 years, 11 months ago by Artem Temos.
-
AuthorPosts
-
January 2, 2021 at 5:57 am #255170
nima ahmadiParticipantHi Good day,
Happy New Year to you and your colleagues
I want to change the pagination structure in WooCommerce pagination.php
And I changed the force code to query string
But when I click page 2, it only loads the ID of the first page,
Thank you for helping me get rid of this structure
The file is attached to you
And I use this code
For shop and blog pages I want the url structure to example.com/shop/?page=2
This is how it comes to be
Thank you
With respectJanuary 2, 2021 at 4:26 pm #255264
Elise NoromitMemberHello,
Happy New Year!
Please provide more details on how exactly you want to change the pagination, what you changed and were added the code I will check with the dev team if it is possible to implement.
Best Regards
January 3, 2021 at 5:34 am #255355
nima ahmadiParticipant<?php /** * Pagination - Show numbered pagination for catalog pages * * This template can be overridden by copying it to yourtheme/woocommerce/loop/pagination.php. * * HOWEVER, on occasion WooCommerce will need to update template files and you * (the theme developer) will need to copy the new files to your theme to * maintain compatibility. We try to do this as little as possible, but it does * happen. When this occurs the version of the template file will be bumped and * the readme will list any important changes. * * @see https://docs.woocommerce.com/document/template-structure/ * @package WooCommerce\Templates * @version 3.3.1 */ if ( ! defined( 'ABSPATH' ) ) { exit; } $total = isset( $total ) ? $total : wc_get_loop_prop( 'total_pages' ); //$current = isset( $current ) ? $current : wc_get_loop_prop( 'current_page' ); $current = get_query_var('page'); // $base = isset( $base ) ? $base : esc_url_raw( str_replace( 999999999, '%#%', remove_query_arg( 'add-to-cart', get_pagenum_link( 999999999, false ) ) ) ); $base = preg_replace('/\?.*/', '/?page=', get_pagenum_link(1)) . '%_%'; // die($base); //$format = isset( $format ) ? $format : ''; $format = '?page=%#%'; if ( $total <= 1 ) { return; } ?> <nav class="woocommerce-pagination"> <?php echo paginate_links( apply_filters( 'woocommerce_pagination_args', array( // WPCS: XSS ok. 'base' => '%_%', 'format' => '?page=%#%', 'total' => $total, 'current' => get_query_var('page')??$_GET['page'], 'show_all' => true, ) ) ); ?> </nav>
This is the code we changed from woocommerce.php in the Woodmart directory
January 4, 2021 at 7:06 am #255485
Artem TemosKeymasterHello,
We are sorry, but such customization of the WooCommerce plugin is out of our theme support scope. We don’t have a working instruction for this, unfortunately.
Kind Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register