| 1 |
<?php |
| 2 |
/* Call the action for team section */ |
| 3 |
add_action('innofit_woocommerce','innofit_woo_section'); |
| 4 |
/* Function for team section*/ |
| 5 |
function innofit_woo_section() |
| 6 |
{ |
| 7 |
if ( class_exists( 'WooCommerce' ) ) { |
| 8 |
$shop_section_enable = get_theme_mod('shop_section_enable','on'); |
| 9 |
if($shop_section_enable !='off') |
| 10 |
{ |
| 11 |
?> |
| 12 |
<!-- Product & Shop Section --> |
| 13 |
<section class="section-module shop" id="shop"> |
| 14 |
<div class="container"> |
| 15 |
|
| 16 |
<?php $home_shop_section_title = get_theme_mod('home_shop_section_title',__('Featured Products','spicebox')); |
| 17 |
$home_shop_section_discription = get_theme_mod('home_shop_section_discription',__('Our amazing products','spicebox')); |
| 18 |
if(($home_shop_section_title) || ($home_shop_section_discription)!='' ) { |
| 19 |
?> |
| 20 |
<div class="row"> |
| 21 |
<div class="section-header"> |
| 22 |
<p class="section-subtitle"><?php echo $home_shop_section_title; ?></p> |
| 23 |
<h1 class="section-title"><?php echo $home_shop_section_discription; ?></h1> |
| 24 |
</div> |
| 25 |
</div> |
| 26 |
<?php } |
| 27 |
$args = array( |
| 28 |
'post_type' => 'product', |
| 29 |
'posts_per_page' => 4, |
| 30 |
); |
| 31 |
/* Exclude hidden products from the loop */ |
| 32 |
$args['tax_query'] = array( |
| 33 |
array( |
| 34 |
'taxonomy' => 'product_visibility', |
| 35 |
'field' => 'name', |
| 36 |
'terms' => 'exclude-from-catalog', |
| 37 |
'operator' => 'NOT IN', |
| 38 |
|
| 39 |
|
| 40 |
), |
| 41 |
); |
| 42 |
?> |
| 43 |
<div class="row"> |
| 44 |
<?php |
| 45 |
$loop = new WP_Query( $args ); |
| 46 |
while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?> |
| 47 |
<div class="item <?php echo the_title(); ?>" data-profile="<?php echo $loop->post->ID; ?>"> |
| 48 |
<div class="col-md-3 col-sm-6 col-xs-12"> |
| 49 |
<div class="products"> |
| 50 |
<div class="item-img"> |
| 51 |
<?php the_post_thumbnail(); ?> |
| 52 |
<?php if ( $product->is_on_sale() ) : ?> |
| 53 |
|
| 54 |
<?php echo apply_filters( 'woocommerce_sale_flash', '<span class="onsale">' . esc_html__( 'On Sale!', 'innofit' ) . '</span>', $product ); ?> |
| 55 |
<?php endif; ?> |
| 56 |
|
| 57 |
<div class="add-to-cart"> |
| 58 |
<?php woocommerce_template_loop_add_to_cart( $loop->post, $product ); ?> |
| 59 |
</div> |
| 60 |
|
| 61 |
</div> |
| 62 |
<div class="product-price"> |
| 63 |
<?php if ($average = $product->get_average_rating()) : ?> |
| 64 |
<ul class="woocommerce rating"> |
| 65 |
<li> |
| 66 |
<?php echo '<div class="star-rating" title="'.sprintf(__( 'Rated %s out of 5', 'innofit' ), $average).'"><span style="width:'.( ( $average / 5 ) * 100 ) . '%"><strong itemprop="ratingValue" class="rating">'.$average.'</strong> '.__( 'out of 5', 'innofit' ).'</span></div>'; ?> |
| 67 |
</li> |
| 68 |
</ul> |
| 69 |
<?php endif; ?> |
| 70 |
<h5 class="woocommerce-loop-product__title"><a href="<?php the_permalink(); ?>" title="" tabindex="-1"><?php the_title(); ?></a></h5> |
| 71 |
<span class="woocommerce-Price-amount"><?php echo $product->get_price_html(); ?></span> |
| 72 |
</div> |
| 73 |
</div> |
| 74 |
</div> |
| 75 |
</div> |
| 76 |
<?php endwhile; ?> |
| 77 |
<?php wp_reset_postdata(); ?> |
| 78 |
</div> |
| 79 |
<!-- /Item Scroll --> |
| 80 |
|
| 81 |
</div> |
| 82 |
</section> |
| 83 |
<!-- /Product & Shop Section --> |
| 84 |
<?php } } }?> |