/templates/single-product.php

  1. <?php 
  2. /** 
  3. * This template displays the single Product 
  4. * 
  5. * @package genesis_connect_woocommerce 
  6. * @version 0.9.8 
  7. * 
  8. * Note for customisers/users: Do not edit this file! 
  9. * ================================================== 
  10. * If you want to customise this template, copy this file (keep same name) and place the 
  11. * copy in the child theme's woocommerce folder, ie themes/my-child-theme/woocommerce 
  12. * (Your theme may not have a 'woocommerce' folder, in which case create one.) 
  13. * The version in the child theme's woocommerce folder will override this template, and 
  14. * any future updates to this plugin won't wipe out your customisations. 
  15. * 
  16. */ 
  17.  
  18. /** Remove default Genesis loop */ 
  19. remove_action( 'genesis_loop', 'genesis_do_loop' ); 
  20.  
  21. /** Remove WooCommerce breadcrumbs */ 
  22. remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 ); 
  23.  
  24. /** Uncomment the below line of code to add back WooCommerce breadcrumbs */ 
  25. //add_action( 'genesis_before_loop', 'woocommerce_breadcrumb', 10, 0 ); 
  26.  
  27. /** Remove Woo #container and #content divs */ 
  28. remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 ); 
  29. remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 ); 
  30.  
  31.  
  32. add_action( 'genesis_loop', 'gencwooc_single_product_loop' ); 
  33. /** 
  34. * Displays single product loop 
  35. * 
  36. * Uses WooCommerce structure and contains all existing WooCommerce hooks 
  37. * 
  38. * Code based on WooCommerce 1.5.5 woocommerce_single_product_content() 
  39. * @see woocommerce/woocommerce-template.php 
  40. * 
  41. * @since 0.9.0 
  42. */ 
  43. function gencwooc_single_product_loop() { 
  44.  
  45. do_action( 'woocommerce_before_main_content' ); 
  46.  
  47. // Let developers override the query used, in case they want to use this function for their own loop/wp_query 
  48. $wc_query = false; 
  49.  
  50. // Added a hook for developers in case they need to modify the query 
  51. $wc_query = apply_filters( 'gencwooc_custom_query', $wc_query ); 
  52.  
  53. if ( ! $wc_query) { 
  54.  
  55. global $wp_query; 
  56.  
  57. $wc_query = $wp_query; 
  58.  
  59. if ( $wc_query->have_posts() ) while ( $wc_query->have_posts() ) : $wc_query->the_post(); ?> 
  60.  
  61. <?php do_action('woocommerce_before_single_product'); ?> 
  62.  
  63. <div itemscope itemtype="http://schema.org/Product" id="product-<?php the_ID(); ?>" <?php post_class(); ?>> 
  64.  
  65. <?php do_action( 'woocommerce_before_single_product_summary' ); ?> 
  66.  
  67. <div class="summary"> 
  68.  
  69. <?php do_action( 'woocommerce_single_product_summary'); ?> 
  70.  
  71. </div> 
  72.  
  73. <?php do_action( 'woocommerce_after_single_product_summary' ); ?> 
  74.  
  75. </div> 
  76.  
  77. <?php do_action( 'woocommerce_after_single_product' ); 
  78.  
  79. endwhile; 
  80.  
  81. do_action( 'woocommerce_after_main_content' ); 
  82.  
  83. genesis(); 
.