Нет описания

result-count.php 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Result Count
  4. *
  5. * Shows text: Showing x - x of x results.
  6. *
  7. * This template can be overridden by copying it to yourtheme/woocommerce/loop/result-count.php.
  8. *
  9. * HOWEVER, on occasion WooCommerce will need to update template files and you
  10. * (the theme developer) will need to copy the new files to your theme to
  11. * maintain compatibility. We try to do this as little as possible, but it does
  12. * happen. When this occurs the version of the template file will be bumped and
  13. * the readme will list any important changes.
  14. *
  15. * @see https://docs.woocommerce.com/document/template-structure/
  16. * @package WooCommerce\Templates
  17. * @version 3.7.0
  18. */
  19. if ( ! defined( 'ABSPATH' ) ) {
  20. exit;
  21. }
  22. ?>
  23. <p class="woocommerce-result-count">
  24. <?php
  25. // phpcs:disable WordPress.Security
  26. if ( 1 === intval( $total ) ) {
  27. _e( 'Showing the single result', 'woocommerce' );
  28. } elseif ( $total <= $per_page || -1 === $per_page ) {
  29. /* translators: %d: total results */
  30. printf( _n( 'Showing all %d result', 'Showing all %d results', $total, 'woocommerce' ), $total );
  31. } else {
  32. $first = ( $per_page * $current ) - $per_page + 1;
  33. $last = min( $total, $per_page * $current );
  34. /* translators: 1: first result 2: last result 3: total results */
  35. printf( _nx( 'Showing %1$d&ndash;%2$d of %3$d result', 'Showing %1$d&ndash;%2$d of %3$d results', $total, 'with first and last result', 'woocommerce' ), $first, $last, $total );
  36. }
  37. // phpcs:enable WordPress.Security
  38. ?>
  39. </p>