/templates/archive-product.php

  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. * @author WooThemes 
  15. * @package WooCommerce/Templates 
  16. * @version 2.0.0 
  17. */ 
  18.  
  19. if ( ! defined( 'ABSPATH' ) ) { 
  20. exit; // Exit if accessed directly 
  21.  
  22. get_header( 'shop' ); ?> 
  23.  
  24. <?php 
  25. /** 
  26. * woocommerce_before_main_content hook. 
  27. * 
  28. * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content) 
  29. * @hooked woocommerce_breadcrumb - 20 
  30. * @hooked WC_Structured_Data::generate_website_data() - 30 
  31. */ 
  32. do_action( 'woocommerce_before_main_content' ); 
  33. ?> 
  34.  
  35. <header class="woocommerce-products-header"> 
  36.  
  37. <?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?> 
  38.  
  39. <h1 class="woocommerce-products-header__title page-title"><?php woocommerce_page_title(); ?></h1> 
  40.  
  41. <?php endif; ?> 
  42.  
  43. <?php 
  44. /** 
  45. * woocommerce_archive_description hook. 
  46. * 
  47. * @hooked woocommerce_taxonomy_archive_description - 10 
  48. * @hooked woocommerce_product_archive_description - 10 
  49. */ 
  50. do_action( 'woocommerce_archive_description' ); 
  51. ?> 
  52.  
  53. </header> 
  54.  
  55. <?php if ( have_posts() ) : ?> 
  56.  
  57. <?php 
  58. /** 
  59. * woocommerce_before_shop_loop hook. 
  60. * 
  61. * @hooked wc_print_notices - 10 
  62. * @hooked woocommerce_result_count - 20 
  63. * @hooked woocommerce_catalog_ordering - 30 
  64. */ 
  65. do_action( 'woocommerce_before_shop_loop' ); 
  66. ?> 
  67.  
  68. <?php woocommerce_product_loop_start(); ?> 
  69.  
  70. <?php woocommerce_product_subcategories(); ?> 
  71.  
  72. <?php while ( have_posts() ) : the_post(); ?> 
  73.  
  74. <?php 
  75. /** 
  76. * woocommerce_shop_loop hook. 
  77. * 
  78. * @hooked WC_Structured_Data::generate_product_data() - 10 
  79. */ 
  80. do_action( 'woocommerce_shop_loop' ); 
  81. ?> 
  82.  
  83. <?php wc_get_template_part( 'content', 'product' ); ?> 
  84.  
  85. <?php endwhile; // end of the loop. ?> 
  86.  
  87. <?php woocommerce_product_loop_end(); ?> 
  88.  
  89. <?php 
  90. /** 
  91. * woocommerce_after_shop_loop hook. 
  92. * 
  93. * @hooked woocommerce_pagination - 10 
  94. */ 
  95. do_action( 'woocommerce_after_shop_loop' ); 
  96. ?> 
  97.  
  98. <?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?> 
  99.  
  100. <?php 
  101. /** 
  102. * woocommerce_no_products_found hook. 
  103. * 
  104. * @hooked wc_no_products_found - 10 
  105. */ 
  106. do_action( 'woocommerce_no_products_found' ); 
  107. ?> 
  108.  
  109. <?php endif; ?> 
  110.  
  111. <?php 
  112. /** 
  113. * woocommerce_after_main_content hook. 
  114. * 
  115. * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content) 
  116. */ 
  117. do_action( 'woocommerce_after_main_content' ); 
  118. ?> 
  119.  
  120. <?php 
  121. /** 
  122. * woocommerce_sidebar hook. 
  123. * 
  124. * @hooked woocommerce_get_sidebar - 10 
  125. */ 
  126. do_action( 'woocommerce_sidebar' ); 
  127. ?> 
  128.  
  129. <?php get_footer( 'shop' ); ?> 
.