pagination.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * Pagination - Show numbered pagination for catalog pages
  4. *
  5. * This template can be overridden by copying it to yourtheme/woocommerce/loop/pagination.php.
  6. *
  7. * HOWEVER, on occasion WooCommerce will need to update template files and you
  8. * (the theme developer) will need to copy the new files to your theme to
  9. * maintain compatibility. We try to do this as little as possible, but it does
  10. * happen. When this occurs the version of the template file will be bumped and
  11. * the readme will list any important changes.
  12. *
  13. * @see https://docs.woocommerce.com/document/template-structure/
  14. * @package WooCommerce/Templates
  15. * @version 3.3.1
  16. */
  17. if ( ! defined( 'ABSPATH' ) ) {
  18. exit;
  19. }
  20. $total = isset( $total ) ? $total : wc_get_loop_prop( 'total_pages' );
  21. $current = isset( $current ) ? $current : wc_get_loop_prop( 'current_page' );
  22. $base = isset( $base ) ? $base : esc_url_raw( str_replace( 999999999, '%#%', remove_query_arg( 'add-to-cart', get_pagenum_link( 999999999, false ) ) ) );
  23. $format = isset( $format ) ? $format : '';
  24. if ( $total <= 1 ) {
  25. return;
  26. }
  27. ?>
  28. <nav class="woocommerce-pagination">
  29. <?php
  30. echo paginate_links( apply_filters( 'woocommerce_pagination_args', array( // WPCS: XSS ok.
  31. 'base' => $base,
  32. 'format' => $format,
  33. 'add_args' => false,
  34. 'current' => max( 1, $current ),
  35. 'total' => $total,
  36. 'prev_text' => '&larr;',
  37. 'next_text' => '&rarr;',
  38. 'type' => 'list',
  39. 'end_size' => 3,
  40. 'mid_size' => 3,
  41. ) ) );
  42. ?>
  43. </nav>