woocommerce_content

Output WooCommerce content.

Description

woocommerce_content(); 

This function is only used in the optional woocommerce.php template. which people can add to their themes to add basic woocommerce support. without hooks or modifying core templates.


Usage

  1. if ( !function_exists( 'woocommerce_content' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-template-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = woocommerce_content(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-template-functions.php  
  1. function woocommerce_content() { 
  2.  
  3. if ( is_singular( 'product' ) ) { 
  4.  
  5. while ( have_posts() ) : the_post(); 
  6.  
  7. wc_get_template_part( 'content', 'single-product' ); 
  8.  
  9. endwhile; 
  10.  
  11. } else { ?> 
  12.  
  13. <?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?> 
  14.  
  15. <h1 class="page-title"><?php woocommerce_page_title(); ?></h1> 
  16.  
  17. <?php endif; ?> 
  18.  
  19. <?php do_action( 'woocommerce_archive_description' ); ?> 
  20.  
  21. <?php if ( have_posts() ) : ?> 
  22.  
  23. <?php do_action( 'woocommerce_before_shop_loop' ); ?> 
  24.  
  25.  
  26.  
  27. <?php while ( have_posts() ) : the_post(); ?> 
  28.  
  29. <?php wc_get_template_part( 'content', 'product' ); ?> 
  30.  
  31. <?php endwhile; // end of the loop. ?> 
  32.  
  33.  
  34. <?php do_action( 'woocommerce_after_shop_loop' ); ?> 
  35.  
  36. <?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?> 
  37.  
  38. <?php do_action( 'woocommerce_no_products_found' ); ?> 
  39.  
  40. <?php endif; 
  41.