result-count.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. * @author WooThemes
  17. * @package WooCommerce/Templates
  18. * @version 3.3.0
  19. */
  20. if ( ! defined( 'ABSPATH' ) ) {
  21. exit;
  22. }
  23. ?>
  24. <p class="woocommerce-result-count">
  25. <?php
  26. if ( $total <= $per_page || -1 === $per_page ) {
  27. /* translators: %d: total results */
  28. printf( _n( 'Showing the single result', 'Showing all %d results', $total, 'woocommerce' ), $total );
  29. } else {
  30. $first = ( $per_page * $current ) - $per_page + 1;
  31. $last = min( $total, $per_page * $current );
  32. /* translators: 1: first result 2: last result 3: total results */
  33. printf( _nx( 'Showing the single result', 'Showing %1$d&ndash;%2$d of %3$d results', $total, 'with first and last result', 'woocommerce' ), $first, $last, $total );
  34. }
  35. ?>
  36. </p>