Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $current_options = wp_parse_args( get_option( 'spa_theme_options', array() ), default_data() );
- if( $current_options['project_hide'] != false ):
- ?>
- <!-- Products Section -->
- <section id="section" class="products bg-color">
- <div class="container">
- <div class="row">
- <div class="col-md-12">
- <div class="section-header">
- <?php
- if( $current_options['product_title'] != '' ):
- ?>
- <h1 class="section-title">
- <?php echo $current_options['product_title'] ?>
- </h1>
- <?php endif; ?>
- <?php
- if( $current_options['product_contents'] != '' ):
- ?>
- <p class="section-subtitle">
- <?php echo $current_options['product_contents'] ?>
- </p>
- <?php endif; ?>
- </div>
- </div>
- </div>
- <div id="product1" class="carousel slide row products" data-ride="carousel" data-type="multi">
- <div class="carousel-inner">
- <?php
- $count_posts = wp_count_posts( 'spa_products')->publish;
- $arg = array( 'post_type' => 'spa_products',
- 'tax_query' => array(
- array(
- 'taxonomy' => 'product_categories',
- 'field' => 'id',
- 'terms' => $current_options['portfolio_selected_category_id'],
- //'operator' => 'NOT IN',
- ),
- ),
- 'posts_per_page' => $count_posts );
- $loop = new WP_Query( $arg );
- $i=1;
- if($loop->have_posts() ):
- while ( $loop->have_posts() ) : $loop->the_post();
- $my_meta = get_post_meta(get_the_ID(),'_my_meta',TRUE);
- if(!empty($my_meta['link']))
- { $meta_value_link = $my_meta['link']; }
- else
- { $meta_value_link = get_permalink(); }
- if(isset($my_meta['check']))
- { $target ='target="_blank"'; } else { $target ='target="_self"'; }
- ?>
- <div class="item <?php echo ($i==1?'active':''); $i++; ?>">
- <div class="column">
- <figure class="product-view">
- <?php if( has_post_thumbnail() ): ?>
- <a href="<?php echo $meta_value_link; ?>" <?php echo $target; ?> title="<?php the_title(); ?>">
- <?php the_post_thumbnail(); ?>
- </a>
- <?php endif; ?>
- <span class="prt-detail">
- <h4>
- <a href="<?php echo $meta_value_link; ?>" <?php echo $target; ?> title="<?php the_title(); ?>">
- <?php the_title(); ?>
- </a>
- </h4>
- <p>
- <?php
- $meta_description = sanitize_text_field( get_post_meta( get_the_ID(), 'description', true ));
- if( !empty( $meta_description ) ){
- echo get_product_description($meta_description, $current_options['product_desc_length']);
- }else{
- echo get_homepage_product_excerpt(get_product_description($my_meta['description'], $current_options['product_desc_length']));
- }
- ?>
- </p>
- </span>
- </figure>
- </div>
- </div>
- <?php
- endwhile;
- else:
- for( $i=1; $i<=12; $i++ ){
- echo '<div class="item '.($i==1?'active':'').'">
- <div class="column">
- <figure class="product-view">
- <img alt="img" src="'.(get_template_directory_uri()).'/images/default/image_232x236.jpg" />
- <span class="prt-detail"><h4><a href="product-detail.html">'.__('Product','spasalon').' '.$i.'</a></h4><p>'.'Pellentesque habitant...'.'</p></span>
- </figure>
- </div>
- </div>';
- }
- endif;
- ?>
- </div>
- <?php if( $loop->post_count > 5 ): ?>
- <ul class="direction-nav">
- <a class="prev" href="#products" data-slide="prev"></a>
- <a class="next" href="#products" data-slide="next"></a>
- </ul>
- <?php endif; ?>
- </div>
- </div>
- </section>
- <!-- End of Products Section -->
- <div class="clearfix"></div>
- <?php endif; ?>
Add Comment
Please, Sign In to add comment