single-product.php
12.5 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
<?php get_header();?>
<?php $get_lang = isset($wp_query->query_vars['prisna_translate_seo_request'])?urldecode($wp_query->query_vars['prisna_translate_seo_request']):''; ?>
<nav class="path-bar">
<ul class="path-nav gm-sep">
<li><?php if(function_exists('cmp_breadcrumbs')) cmp_breadcrumbs();?></li>
</ul>
</nav>
<div id="loading"></div>
<section class="layout main_content">
<!-- aside begin -->
<?php get_sidebar();?>
<!--// aisde end -->
<!-- main begin -->
<section class="main" >
<div class="main-tit-bar">
<h1 class="title"><?php wp_title(); ?></h1>
</div>
<!-- product info -->
<section class="product-intro">
<div class="product-view" >
<!-- Piliang S-->
<?php $images = get_field('product_gallery');
if( $images ): foreach( $images as $key=>$image ):
if(!is_array($images[$key])){
$eric_id = $image;
$eric_urcs = wp_get_attachment_image_src($eric_id, $size='full');
$eric_urc = $eric_urcs[0];
$image = array(
'id' => $eric_id,
'url' => $eric_urc,
'sizes' => array('thumbnail' => $eric_urc, )
);
$images[$key] = $image;
}
if (!$image['sizes']['thumbnail']) $image['sizes']['thumbnail'] = $srcs[0]; endforeach; endif; ?>
<!-- Piliang E-->
<?php if( $images ): for($x=0;$x<1; $x++){ ?><div class="product-image"><a class="cloud-zoom" id="zoom1" data-zoom="adjustX:0, adjustY:0" href="<?php echo $images[0]['url']; ?>">
<img src="<?php echo $images[0]['url']; ?>" itemprop="image" title="" alt="<?php wp_title(); ?> Featured Image" style="width:100%" /></a>
</div><?php } endif; ?>
<div class="image-additional">
<ul class="image-items">
<?php $i=1; if( $images ): foreach( $images as $image ): ?>
<li class="image-item <?php if($i==1) : ?>current<?php endif; ?>"><a class="cloud-zoom-gallery item" href="<?php echo $image['url']; ?>" data-zoom="useZoom:zoom1, smallImage:<?php echo $image['url']; ?>"><img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php wp_title(); ?>" /></a></li>
<?php $i++; endforeach;endif; ?>
</ul>
</div>
</div>
<section class="product-summary">
<div class="product-meta">
<h3>Short Description:</h3>
<p><?php the_field('short_description'); ?></p>
<br />
<?php if( get_field('是否调用通用属性') ){ ?>
<?php query_posts(array( 'post_type' => 'pro_shuxing','showposts' => 1,'orderby' => 'post_date','order'=> 'DESC') ); while (have_posts()) : the_post();?>
<?php if( have_rows('产品通用属性') ): ?>
<?php while( have_rows('产品通用属性') ): the_row(); ?>
<li><em><?php echo get_sub_field('标题'); ?>: </em> <?php echo get_sub_field('内容'); ?></li>
<?php endwhile; ?>
<?php endif; ?>
<?php endwhile; wp_reset_query(); ?>
<?php } ?>
<?php if( have_rows('当前产品属性') ): ?>
<?php while( have_rows('当前产品属性') ): the_row(); ?>
<li><em><?php echo get_sub_field('标题'); ?>: </em> <?php echo get_sub_field('内容'); ?></li>
<?php endwhile; ?>
<?php endif; ?>
</div>
<div class="gm-sep product-btn-wrap">
<a href="javascript:" onclick="showMsgPop();" class="email">Send email to us</a>
<a href="<?php echo home_url("/"); ?>wp-content/plugins/down-as-pdf/generate.php?id=<?php the_ID(); ?>" target="_blank" rel="external nofollow" class="pdf">Download as PDF</a>
</div>
<div class="share-this"><div class="addthis_sharing_toolbox"></div></div>
</section>
</section>
<section class="tab-content-wrap product-detail">
<div class="tab-title-bar detail-tabs">
<h2 class="tab-title title current"><span>Product Detail</span></h2>
<?php query_posts(array( 'post_type' => 'pro_detail','showposts' => 1,'orderby' => 'post_date','order'=> 'DESC') ); while (have_posts()) : the_post();?>
<?php if( have_rows('pro_detail') ): ?>
<?php while( have_rows('pro_detail') ): the_row(); ?>
<h2 class="tab-title title"><span><?php echo get_sub_field('title'); ?></span></h2>
<?php endwhile; ?>
<?php endif; ?>
<?php endwhile; wp_reset_query(); ?>
<h2 class="tab-title title"><span>Product Tags</span></h2>
<?php if( in_category('623') ) : ?>
<h2 class="tab-title title"><span>Related Video</span></h2>
<h2 class="tab-title title"><span>Feedback (2)</span></h2>
<?php endif; ?>
</div>
<section class="tab-panel-wrap">
<section class="tab-panel disabled entry">
<section class="tab-panel-content">
<?php if( in_category('623') ) : ?>
<?php echo do_shortcode( '[rand_pre]' ); ?> <?php echo do_shortcode( '[rand_keywords]' ); ?>, <?php echo do_shortcode( '[rand_keywords]' ); ?>, <?php echo do_shortcode( '[rand_keywords]' ); ?>, <?php echo do_shortcode( '[rand_suffix]' ); ?>
<hr>
<?php wp_title(); ?> Detail: <br/><br/>
<?php endif; ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
<div class="clear"></div>
<?php if( in_category('623') ) : ?>
<hr>
Product detail pictures:<br/><br/>
<?php
if( $images ): ?>
<?php foreach( $images as $image ): ?>
<center><a class="lightbox" href="<?php echo $image['url']; ?>"><img src="<?php echo $image['url']; ?>" alt="<?php wp_title(); ?> detail pictures"></a></center><br />
<?php endforeach; ?>
<?php endif; ?>
<hr>
Related Product Guide:<br/>
<?php query_posts(array( 'post_type' => 'guide','showposts' => 2,'orderby' => 'rand') ); while (have_posts()) : the_post();?>
<a href="<?php the_permalink() ?>"><?php echo mb_strimwidth(strip_tags(apply_filters('the_title',$post->post_title)), 0, 500,"..."); ?></a><br/>
<?php endwhile; wp_reset_query();?>
<hr>
<?php echo do_shortcode( '[rand_pre]' ); ?> <?php wp_title(); ?>, The product will supply to all over the world, such as: <?php echo do_shortcode( '[rand_country]' ); ?>, <?php echo do_shortcode( '[rand_country]' ); ?>, <?php echo do_shortcode( '[rand_country]' ); ?>, <?php echo do_shortcode( '[rand_l_suffix]' ); ?>
<?php endif; ?>
<?php if( get_field('yes_products_img') ){ ?>
<hr>
<?php
if( $images ): ?>
<?php foreach( $images as $image ): ?>
<center><a class="lightbox" href="<?php echo $image['url']; ?>"><img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>"></a></center><br />
<?php endforeach; ?>
<?php endif; ?>
<?php } ?>
<?php if( in_category('623') ) { ?> <?php } else { ?>
<hr>
<li><b>Previous:</b> <?php previous_post_link("%link") ?></li>
<li><b>Next:</b> <?php next_post_link("%link") ?></li>
<hr><?php } ?>
</section>
</section>
<?php query_posts(array( 'post_type' => 'pro_detail','showposts' => 1,'orderby' => 'post_date','order'=> 'DESC') ); while (have_posts()) : the_post();?>
<?php if( have_rows('pro_detail') ): ?>
<?php while( have_rows('pro_detail') ): the_row(); ?>
<section class="tab-panel disabled entry">
<section class="tab-panel-content">
<?php echo get_sub_field('text'); ?>
</section>
</section>
<?php endwhile; ?>
<?php endif; ?>
<?php endwhile; wp_reset_query(); ?>
<section class="tab-panel disabled entry">
<section class="tab-panel-content">
<?php the_tags(); ?> </section>
</section>
<?php if( in_category('623') ) : ?>
<section class="tab-panel disabled entry"><section class="tab-panel-content">
<?php query_posts(array( 'post_type' => 'vs','showposts' => 2,'orderby' => 'rand') ); while (have_posts()) : the_post();?>
<?php echo apply_filters('the_content', $post->post_content); ?>
<?php endwhile; wp_reset_query();?>
</section></section>
<section class="tab-panel disabled entry"><section class="tab-panel-content">
<?php echo do_shortcode( '[rand_feedback]' ); ?>
<br /><img src="<?php echo home_url("/"); ?>admin/img/star-icon.png" alt="5 Stars"> <span style="color:#cccccc">By <?php echo do_shortcode( '[rand_feedback_name]' ); ?> from <?php echo do_shortcode( '[rand_country]' ); ?> - <?php echo do_shortcode( '[rand_feedback_time]' ); ?></span>
<hr>
<?php echo do_shortcode( '[rand_feedback]' ); ?>
<br /><img src="<?php echo home_url("/"); ?>admin/img/star-icon.png" alt="5 Stars"> <span style="color:#cccccc">By <?php echo do_shortcode( '[rand_feedback_name]' ); ?> from <?php echo do_shortcode( '[rand_country]' ); ?> - <?php echo do_shortcode( '[rand_feedback_time]' ); ?></span>
<hr>
</section></section>
<?php endif; ?>
</section>
</section>
<section id="send-email" class="inquiry-form-wrap ct-inquiry-form"><script type="text/javascript" src="//www.globalso.site/form.js"></script></section>
<div class="goods-may-like">
<div class="goods-title-bar"><h2 class="title">RELATED PRODUCTS</h2></div>
<ul class="goods-items">
<?php $post_objects = get_field('related_products'); if( $post_objects ): ?>
<?php foreach( $post_objects as $post): ?>
<?php setup_postdata($post);
$images = get_field('product_gallery');
if( $images ): foreach( $images as $key=>$image ):
if(!is_array($images[$key])){
$eric_id = $image;
$eric_urcs = wp_get_attachment_image_src($eric_id, $size='full');
$eric_urc = $eric_urcs[0];
$image = array(
'id' => $eric_id,
'url' => $eric_urc,
'sizes' => array('thumbnail' => $eric_urc, )
);
$images[$key] = $image;
}
if (!$image['sizes']['thumbnail']) $image['sizes']['thumbnail'] = $srcs[0];
endforeach; endif;?>
<li class="product-item wow flipInY">
<figure class="item-wrap">
<div class="item-img"><a href="<?php the_permalink() ?>"><img src="<?php $images = get_field('product_gallery'); if( $images ): for($x=0;$x<1; $x++){ ?><?php echo $images[0]['sizes']['thumbnail']; ?><?php } endif; ?>" alt="<?php echo mb_strimwidth(strip_tags(apply_filters('the_title',$post->post_title)), 0, 200,"..."); ?>"/></a><a href="<?php the_permalink() ?>" class="item-shadow"></a></div>
<figcaption class="item-info">
<h3 class="item-title"> <a href="<?php the_permalink() ?>" class="item-txt"><?php echo mb_strimwidth(strip_tags(apply_filters('the_title',$post->post_title)), 0, 50,"..."); ?></a><a href="<?php the_permalink() ?>" class="item-underline"></a> </h3>
</figcaption>
</figure>
</li>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
<?php else: ?>
<?php
global $post;
$cats = wp_get_post_categories($post->ID);
if ($cats) {
$args = array(
'category__in' => array( $cats[0] ),
'post__not_in' => array( $post->ID ),
'orderby' => 'rand',
'showposts' => 6,
'caller_get_posts' => 1
);
query_posts($args);
if (have_posts()) {
while (have_posts()) {
the_post(); update_post_caches($posts);
$images = get_field('product_gallery');
if( $images ): foreach( $images as $key=>$image ):
if(!is_array($images[$key])){
$eric_id = $image;
$eric_urcs = wp_get_attachment_image_src($eric_id, $size='full');
$eric_urc = $eric_urcs[0];
$image = array(
'id' => $eric_id,
'url' => $eric_urc,
'sizes' => array('thumbnail' => $eric_urc, )
);
$images[$key] = $image;
}
if (!$image['sizes']['thumbnail']) $image['sizes']['thumbnail'] = $srcs[0];
endforeach; endif;?>
<li class="product-item wow flipInY">
<figure class="item-wrap">
<div class="item-img"><a href="<?php the_permalink() ?>"><img src="<?php $images = get_field('product_gallery'); if( $images ): for($x=0;$x<1; $x++){ ?><?php echo $images[0]['sizes']['thumbnail']; ?><?php } endif; ?>" alt="<?php echo mb_strimwidth(strip_tags(apply_filters('the_title',$post->post_title)), 0, 200,"..."); ?>"/></a><a href="<?php the_permalink() ?>" class="item-shadow"></a></div>
<figcaption class="item-info">
<h3 class="item-title"> <a href="<?php the_permalink() ?>" class="item-txt"><?php echo mb_strimwidth(strip_tags(apply_filters('the_title',$post->post_title)), 0, 50,"..."); ?></a><a href="<?php the_permalink() ?>" class="item-underline"></a> </h3>
</figcaption>
</figure>
</li>
<?php } } wp_reset_query(); } ?>
<?php endif;?>
</ul>
</div>
</section>
</section>
<!--// main end -->
<div class="clear"></div>
<?php get_footer();?>