215 lines
		
	
	
		
			7.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			215 lines
		
	
	
		
			7.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
/*
 | 
						|
Template Name: Home Page JigoShop Template
 | 
						|
*/
 | 
						|
?>
 | 
						|
<?php
 | 
						|
	get_header();
 | 
						|
	
 | 
						|
	do_action('jigoshop_before_shop_loop');
 | 
						|
	
 | 
						|
	while (have_posts()) : 
 | 
						|
		
 | 
						|
		the_post();
 | 
						|
		add_filter('embed_defaults', 'pk_page_embed_defaults');
 | 
						|
		
 | 
						|
		if (get_the_content()) :
 | 
						|
?>
 | 
						|
 | 
						|
					<!-- pk start contents -->
 | 
						|
					<section id="pk_page_content" class="pk_clearfix">
 | 
						|
						<?php
 | 
						|
		the_content();
 | 
						|
?>
 | 
						|
 | 
						|
					</section>
 | 
						|
					<!-- pk end contents -->
 | 
						|
<?php
 | 
						|
		endif;
 | 
						|
		
 | 
						|
	endwhile;
 | 
						|
	
 | 
						|
	$post_meta = get_post_custom(get_the_ID());
 | 
						|
	
 | 
						|
	if (is_active_sidebar('sidebar_home_page_jigoshop_left') || is_active_sidebar('sidebar_home_page_jigoshop_right')) : 
 | 
						|
?>
 | 
						|
 | 
						|
					<!-- pk start widgets areas -->
 | 
						|
					<section id="pk_home_jigoshop_widgets" class="pk_clearfix">
 | 
						|
						<div class="pk_one_half">
 | 
						|
 | 
						|
<?php if (dynamic_sidebar('sidebar_home_page_jigoshop_left')) : endif; ?>
 | 
						|
						</div>
 | 
						|
						<div class="pk_one_half pk_last">
 | 
						|
 | 
						|
<?php if (dynamic_sidebar('sidebar_home_page_jigoshop_right')) : endif; ?>
 | 
						|
						</div>
 | 
						|
					</section>
 | 
						|
					<!-- pk end widgets areas -->
 | 
						|
<?php
 | 
						|
	endif;
 | 
						|
	
 | 
						|
	if (function_exists('jigoshop_product')) : 
 | 
						|
		
 | 
						|
		if (pk_get_option('homepages_latest_products', 'true') == 'true') : 
 | 
						|
?>
 | 
						|
					
 | 
						|
					<!-- pk start latest products -->
 | 
						|
					<section id="pk_latest_products" class="pk_clearfix">
 | 
						|
						<h3 class="pk_heading_uppercase"><?php _e('Latest products', 'pk_translate'); ?></h3>
 | 
						|
						<p class="pk_button_view_all"><a href="<?php echo ((function_exists('jigoshop_get_page_id')) ? get_permalink((function_exists('icl_object_id')) ? icl_object_id(jigoshop_get_page_id('shop'), 'page', true) : jigoshop_get_page_id('shop')) : '#'); ?>" title="<?php _e('View all', 'pk_translate'); ?>" class="pk_button_mini pk_button_<?php echo ((isset($post_meta['_view_all_button_color'][0])) ? $post_meta['_view_all_button_color'][0] : 'white'); ?>"><span><?php _e('View all', 'pk_translate'); ?></span></a></p>
 | 
						|
<?php
 | 
						|
			$total_recent_products = (isset($post_meta['_total_recent_products'][0])) ? (int)trim($post_meta['_total_recent_products'][0]) : 2;
 | 
						|
			
 | 
						|
			$temp_query = $wp_query;
 | 
						|
			
 | 
						|
			$query_args['post_type'] = 'product';
 | 
						|
			$query_args['post_status'] = 'publish';
 | 
						|
			$query_args['orderby'] = 'date';
 | 
						|
			$query_args['order'] = 'desc';
 | 
						|
			$query_args['meta_query'] = array(array('key' => 'visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'));
 | 
						|
			$query_args['posts_per_page'] = $total_recent_products;
 | 
						|
			
 | 
						|
			$wp_query = new WP_Query($query_args);
 | 
						|
			
 | 
						|
			$c = 0;
 | 
						|
			
 | 
						|
			if (have_posts()) : 
 | 
						|
				
 | 
						|
				while (have_posts()) : 
 | 
						|
					
 | 
						|
					the_post();
 | 
						|
					$c++;
 | 
						|
					$product = new jigoshop_product(get_the_ID());
 | 
						|
?>
 | 
						|
						<div class="pk_one_half pk_fixed<?php if ($c == 2) echo ' pk_last'; ?>">
 | 
						|
							<div class="pk_entry pk_entry_product pk_boxed pk_full_content">
 | 
						|
								<?php jigoshop_show_product_sale_flash(get_the_ID(), $product); ?>
 | 
						|
<?php
 | 
						|
					if (has_post_thumbnail()) : 
 | 
						|
?>
 | 
						|
								<div class="pk_image">
 | 
						|
									<div class="pk_image_wrapper pk_zoom_icon">
 | 
						|
										<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
 | 
						|
											<?php the_post_thumbnail('shop_large'); ?>
 | 
						|
 | 
						|
											<span class="pk_image_button_back_ground"></span>
 | 
						|
											<span class="pk_image_button_icon"></span>
 | 
						|
										</a>
 | 
						|
									</div>
 | 
						|
								</div>
 | 
						|
<?php
 | 
						|
					endif;
 | 
						|
?>
 | 
						|
								<div class="pk_entry_content">
 | 
						|
									<header>
 | 
						|
                                    	<p class="pk_entry_price"><?php echo $product -> get_price_html(); ?></p>
 | 
						|
										<p class="pk_button_add_cart"><?php jigoshop_template_loop_add_to_cart(get_the_ID(), $product); ?></p>
 | 
						|
                                    </header>
 | 
						|
                                    <h4><?php the_title(); ?></h4>
 | 
						|
									<p><?php echo wp_trim_words(get_the_excerpt(), 15, '…'); ?></p>
 | 
						|
									<footer>
 | 
						|
                                    	<a href="<?php the_permalink(); ?>" title="<?php _e('Read more', 'pk_translate'); ?>" class="pk_button_read_more"><?php _e('Details', 'pk_translate'); ?></a>
 | 
						|
									</footer>
 | 
						|
								</div>
 | 
						|
							</div>
 | 
						|
						</div>
 | 
						|
<?php
 | 
						|
					if ($c == 2) $c = 0;
 | 
						|
					
 | 
						|
				endwhile;
 | 
						|
				
 | 
						|
			endif;
 | 
						|
?>
 | 
						|
					</section>
 | 
						|
					<!-- pk end latest products -->
 | 
						|
<?php
 | 
						|
			$wp_query = $temp_query;
 | 
						|
			wp_reset_query();
 | 
						|
			
 | 
						|
			unset($query_args);
 | 
						|
			
 | 
						|
		endif;
 | 
						|
		
 | 
						|
		if (pk_get_option('homepages_featured_products', 'true') == 'true') : 
 | 
						|
?>
 | 
						|
 | 
						|
					<!-- pk start featured products -->
 | 
						|
					<section id="pk_featured_products" class="pk_last_section pk_clearfix">
 | 
						|
						<h3 class="pk_heading_uppercase"><?php _e('Featured products', 'pk_translate'); ?></h3>
 | 
						|
						<p class="pk_button_view_all"><a href="<?php echo ((function_exists('jigoshop_get_page_id')) ? get_permalink((function_exists('icl_object_id')) ? icl_object_id(jigoshop_get_page_id('shop'), 'page', true) : jigoshop_get_page_id('shop')) : '#'); ?>" title="<?php _e('View all', 'pk_translate'); ?>" class="pk_button_mini pk_button_<?php echo ((isset($post_meta['_view_all_button_color'][0])) ? $post_meta['_view_all_button_color'][0] : 'white'); ?>"><span><?php _e('View all', 'pk_translate'); ?></span></a></p>
 | 
						|
<?php
 | 
						|
			$total_featured_products = (isset($post_meta['_total_featured_products'][0]) && trim($post_meta['_total_featured_products'][0]) != '') ? (int)trim($post_meta['_total_featured_products'][0]) : 3;
 | 
						|
			
 | 
						|
			$temp_query = $wp_query;
 | 
						|
			
 | 
						|
			$query_args['post_type'] = 'product';
 | 
						|
			$query_args['post_status'] = 'publish';
 | 
						|
			$query_args['meta_key'] = 'featured';
 | 
						|
			$query_args['meta_value'] = '1';
 | 
						|
			$query_args['meta_query'] = array(array('key' => 'visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'));
 | 
						|
			$query_args['posts_per_page'] = $total_featured_products;
 | 
						|
			
 | 
						|
			$wp_query = new WP_Query($query_args);
 | 
						|
			
 | 
						|
			$c = 0;
 | 
						|
			
 | 
						|
			if (have_posts()) : 
 | 
						|
				
 | 
						|
				while (have_posts()) : 
 | 
						|
					
 | 
						|
					the_post();
 | 
						|
					$c++;
 | 
						|
					$product = new jigoshop_product(get_the_ID());
 | 
						|
?>
 | 
						|
						<div class="pk_one_third pk_fixed<?php if ($c == 3) echo ' pk_last'; ?>">
 | 
						|
							<div class="pk_entry pk_entry_product pk_boxed pk_full_content">
 | 
						|
								<?php jigoshop_show_product_sale_flash(get_the_ID(), $product); ?>
 | 
						|
<?php
 | 
						|
					if (has_post_thumbnail()) : 
 | 
						|
?>
 | 
						|
								<div class="pk_image">
 | 
						|
									<div class="pk_image_wrapper pk_zoom_icon">
 | 
						|
										<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
 | 
						|
											<?php the_post_thumbnail('shop_large'); ?>
 | 
						|
 | 
						|
											<span class="pk_image_button_back_ground"></span>
 | 
						|
											<span class="pk_image_button_icon"></span>
 | 
						|
										</a>
 | 
						|
									</div>
 | 
						|
								</div>
 | 
						|
<?php
 | 
						|
					endif;
 | 
						|
?>
 | 
						|
								<div class="pk_entry_content">
 | 
						|
									<header>
 | 
						|
                                    	<p class="pk_entry_price"><?php echo $product -> get_price_html(); ?></p>
 | 
						|
                                    </header>
 | 
						|
                                    <h4><?php the_title(); ?></h4>
 | 
						|
									<p><?php echo wp_trim_words(get_the_excerpt(), 7, '…'); ?></p>
 | 
						|
                                    <a href="<?php the_permalink(); ?>" title="<?php _e('Read more', 'pk_translate'); ?>" class="pk_button_read_more"><?php _e('Details', 'pk_translate'); ?></a>
 | 
						|
									<footer>
 | 
						|
                                    	<p class="pk_button_add_cart"><?php jigoshop_template_loop_add_to_cart(get_the_ID(), $product); ?></p>
 | 
						|
                                    </footer>
 | 
						|
								</div>
 | 
						|
							</div>
 | 
						|
						</div>
 | 
						|
<?php
 | 
						|
					if ($c == 3) $c = 0;
 | 
						|
					
 | 
						|
				endwhile;
 | 
						|
				
 | 
						|
			endif;
 | 
						|
?>
 | 
						|
					</section>
 | 
						|
					<!-- pk end featured products -->
 | 
						|
<?php
 | 
						|
			$wp_query = $temp_query;
 | 
						|
			wp_reset_query();
 | 
						|
			
 | 
						|
		endif;
 | 
						|
		
 | 
						|
	endif;
 | 
						|
	
 | 
						|
	get_footer();
 | 
						|
?>
 |