-
Notifications
You must be signed in to change notification settings - Fork 0
/
featured-products.php
102 lines (91 loc) · 3.8 KB
/
featured-products.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<div id="featured-products" class="container featured-area">
<div class="col-md-4 col-sm-4">
<div class="section-title title-font">
<span><div><?php echo esc_html( get_theme_mod('kurama_slider_title','Featured Products') ); ?></div></span>
</div>
<div class="fp-container">
<div class="swiper-wrapper">
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => get_theme_mod('kurama_slider_count',10),
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'terms' => esc_html( get_theme_mod('kurama_slider_cat',0) ),
'operator' => 'IN' // Possible values are 'IN', 'NOT IN', 'AND'.
)
)
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) :
$loop->the_post();
global $product;
$image_url = get_template_directory_uri()."/assets/images/placeholder-sq.jpg";
if ( has_post_thumbnail() ) :
$image_data = wp_get_attachment_image_src( get_post_thumbnail_id( $loop->post->ID), 'shop_catalog' );
$image_url = $image_data[0];
endif;
?>
<div class="swiper-slide">
<a href="<?php echo get_permalink( $loop->post->ID ) ?>" title="<?php echo esc_attr($loop->post->post_title ? $loop->post->post_title : $loop->post->ID); ?>">
<img src="<?php echo $image_url; ?>">
<div class="product-details">
<h3><?php the_title(); ?></h3>
<span class="price"><?php echo $product->get_price_html(); ?></span>
</div>
</a>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</div>
<!-- Add Pagination -->
<div class="swiper-button-next sbnc swiper-button-white"></div>
<div class="swiper-button-prev sbpc swiper-button-white"></div>
</div>
</div>
<!--col-md-4-ends-->
<div class="col-md-8 col-sm-8">
<div class="section-title title-font">
<span><div><?php echo esc_html( get_theme_mod('kurama_box_title','Trending') ) ?></div></span>
</div>
<div class="featured-grid-container">
<div class="fg-wrapper">
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => 8,
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'terms' => esc_html( get_theme_mod('kurama_box_cat',0) ),
'operator' => 'IN' // Possible values are 'IN', 'NOT IN', 'AND'.
)
)
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) :
$loop->the_post();
global $product;
if ( has_post_thumbnail() ) :
$image_data = wp_get_attachment_image_src( get_post_thumbnail_id( $loop->post->ID), 'shop_catalog' );
$image_url = $image_data[0];
endif;
?>
<div class="fg-item-container col-md-3 col-sm-3 col-xs-6">
<div class="fg-item">
<a href="<?php echo get_permalink( $loop->post->ID ) ?>" title="<?php echo esc_attr($loop->post->post_title ? $loop->post->post_title : $loop->post->ID); ?>">
<img src="<?php echo $image_url; ?>">
<div class="product-details">
<h3><?php the_title(); ?></h3>
<span class="price"><?php echo $product->get_price_html(); ?></span>
</div>
</a>
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</div>
</div>
</div>
</div>