archive-product.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. /**
  3. * The Template for displaying product archives, including the main shop page which is a post type archive
  4. *
  5. * This template can be overridden by copying it to yourtheme/woocommerce/archive-product.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.4.0
  16. */
  17. defined( 'ABSPATH' ) || exit;
  18. get_header( 'shop' );
  19. /**
  20. * Hook: woocommerce_before_main_content.
  21. *
  22. * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
  23. * @hooked woocommerce_breadcrumb - 20
  24. * @hooked WC_Structured_Data::generate_website_data() - 30
  25. */
  26. do_action( 'woocommerce_before_main_content' );
  27. ?>
  28. <header class="woocommerce-products-header">
  29. <?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
  30. <h1 class="woocommerce-products-header__title page-title"><?php woocommerce_page_title(); ?></h1>
  31. <?php endif; ?>
  32. <?php
  33. /**
  34. * Hook: woocommerce_archive_description.
  35. *
  36. * @hooked woocommerce_taxonomy_archive_description - 10
  37. * @hooked woocommerce_product_archive_description - 10
  38. */
  39. do_action( 'woocommerce_archive_description' );
  40. ?>
  41. </header>
  42. <?php
  43. if ( woocommerce_product_loop() ) {
  44. /**
  45. * Hook: woocommerce_before_shop_loop.
  46. *
  47. * @hooked wc_print_notices - 10
  48. * @hooked woocommerce_result_count - 20
  49. * @hooked woocommerce_catalog_ordering - 30
  50. */
  51. do_action( 'woocommerce_before_shop_loop' );
  52. woocommerce_product_loop_start();
  53. if ( wc_get_loop_prop( 'total' ) ) {
  54. while ( have_posts() ) {
  55. the_post();
  56. /**
  57. * Hook: woocommerce_shop_loop.
  58. *
  59. * @hooked WC_Structured_Data::generate_product_data() - 10
  60. */
  61. do_action( 'woocommerce_shop_loop' );
  62. wc_get_template_part( 'content', 'product' );
  63. }
  64. }
  65. woocommerce_product_loop_end();
  66. /**
  67. * Hook: woocommerce_after_shop_loop.
  68. *
  69. * @hooked woocommerce_pagination - 10
  70. */
  71. do_action( 'woocommerce_after_shop_loop' );
  72. } else {
  73. /**
  74. * Hook: woocommerce_no_products_found.
  75. *
  76. * @hooked wc_no_products_found - 10
  77. */
  78. do_action( 'woocommerce_no_products_found' );
  79. }
  80. /**
  81. * Hook: woocommerce_after_main_content.
  82. *
  83. * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
  84. */
  85. do_action( 'woocommerce_after_main_content' );
  86. /**
  87. * Hook: woocommerce_sidebar.
  88. *
  89. * @hooked woocommerce_get_sidebar - 10
  90. */
  91. do_action( 'woocommerce_sidebar' );
  92. get_footer( 'shop' );