Guest User

Untitled

a guest
Sep 24th, 2018
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.21 KB | None | 0 0
  1. <?php
  2. $current_options = wp_parse_args( get_option( 'spa_theme_options', array() ), default_data() );
  3.  
  4. if( $current_options['project_hide'] != false ):
  5. ?>
  6. <!-- Products Section -->
  7. <section id="section" class="products bg-color">
  8. <div class="container">
  9.  
  10. <div class="row">
  11. <div class="col-md-12">
  12. <div class="section-header">
  13.  
  14. <?php
  15. if( $current_options['product_title'] != '' ):
  16. ?>
  17. <h1 class="section-title">
  18. <?php echo $current_options['product_title'] ?>
  19. </h1>
  20. <?php endif; ?>
  21.  
  22. <?php
  23. if( $current_options['product_contents'] != '' ):
  24. ?>
  25. <p class="section-subtitle">
  26. <?php echo $current_options['product_contents'] ?>
  27. </p>
  28. <?php endif; ?>
  29.  
  30. </div>
  31. </div>
  32. </div>
  33.  
  34.  
  35.  
  36. <div id="product1" class="carousel slide row products" data-ride="carousel" data-type="multi">
  37.  
  38. <div class="carousel-inner">
  39.  
  40. <?php
  41. $count_posts = wp_count_posts( 'spa_products')->publish;
  42.  
  43. $arg = array( 'post_type' => 'spa_products',
  44.  
  45. 'tax_query' => array(
  46. array(
  47. 'taxonomy' => 'product_categories',
  48. 'field' => 'id',
  49. 'terms' => $current_options['portfolio_selected_category_id'],
  50. //'operator' => 'NOT IN',
  51. ),
  52. ),
  53. 'posts_per_page' => $count_posts );
  54.  
  55. $loop = new WP_Query( $arg );
  56.  
  57. $i=1;
  58.  
  59. if($loop->have_posts() ):
  60.  
  61. while ( $loop->have_posts() ) : $loop->the_post();
  62.  
  63. $my_meta = get_post_meta(get_the_ID(),'_my_meta',TRUE);
  64.  
  65. if(!empty($my_meta['link']))
  66. { $meta_value_link = $my_meta['link']; }
  67. else
  68. { $meta_value_link = get_permalink(); }
  69.  
  70. if(isset($my_meta['check']))
  71. { $target ='target="_blank"'; } else { $target ='target="_self"'; }
  72. ?>
  73.  
  74. <div class="item <?php echo ($i==1?'active':''); $i++; ?>">
  75.  
  76. <div class="column">
  77.  
  78. <figure class="product-view">
  79.  
  80. <?php if( has_post_thumbnail() ): ?>
  81.  
  82. <a href="<?php echo $meta_value_link; ?>" <?php echo $target; ?> title="<?php the_title(); ?>">
  83. <?php the_post_thumbnail(); ?>
  84. </a>
  85.  
  86. <?php endif; ?>
  87.  
  88. <span class="prt-detail">
  89.  
  90. <h4>
  91. <a href="<?php echo $meta_value_link; ?>" <?php echo $target; ?> title="<?php the_title(); ?>">
  92. <?php the_title(); ?>
  93. </a>
  94. </h4>
  95.  
  96. <p>
  97. <?php
  98. $meta_description = sanitize_text_field( get_post_meta( get_the_ID(), 'description', true ));
  99. if( !empty( $meta_description ) ){
  100.  
  101. echo get_product_description($meta_description, $current_options['product_desc_length']);
  102. }else{
  103.  
  104. echo get_homepage_product_excerpt(get_product_description($my_meta['description'], $current_options['product_desc_length']));
  105. }
  106. ?>
  107. </p>
  108.  
  109. </span>
  110.  
  111. </figure>
  112.  
  113. </div>
  114. </div>
  115.  
  116. <?php
  117.  
  118. endwhile;
  119.  
  120. else:
  121.  
  122. for( $i=1; $i<=12; $i++ ){
  123.  
  124. echo '<div class="item '.($i==1?'active':'').'">
  125. <div class="column">
  126. <figure class="product-view">
  127. <img alt="img" src="'.(get_template_directory_uri()).'/images/default/image_232x236.jpg" />
  128. <span class="prt-detail"><h4><a href="product-detail.html">'.__('Product','spasalon').' '.$i.'</a></h4><p>'.'Pellentesque habitant...'.'</p></span>
  129. </figure>
  130. </div>
  131. </div>';
  132.  
  133. }
  134.  
  135. endif;
  136.  
  137. ?>
  138.  
  139. </div>
  140.  
  141. <?php if( $loop->post_count > 5 ): ?>
  142.  
  143. <ul class="direction-nav">
  144. <a class="prev" href="#products" data-slide="prev"></a>
  145. <a class="next" href="#products" data-slide="next"></a>
  146. </ul>
  147.  
  148. <?php endif; ?>
  149.  
  150. </div>
  151.  
  152. </div>
  153. </section>
  154. <!-- End of Products Section -->
  155.  
  156. <div class="clearfix"></div>
  157.  
  158. <?php endif; ?>
Add Comment
Please, Sign In to add comment