1. <?php
  2. /**
  3. * Index Template
  4. *
  5. * Here we setup all logic and XHTML that is required for the index template, used as both the homepage
  6. * and as a fallback template, if a more appropriate template file doesn't exist for a specific context.
  7. *
  8. * @package WooFramework
  9. * @subpackage Template
  10. */
  11. get_header();
  12. global $woo_options;
  13. global $woocommerce_loop;
  14.  
  15. ?>
  16.  
  17. <!-- The stand first -->
  18. <?php if( isset( $woo_options['woo_stand_first'] ) ) {
  19. echo '<h1 class="stand-first">';
  20. echo stripslashes( $woo_options['woo_stand_first'] );
  21. echo '</h1>';
  22. } ?>
  23.  
  24. <div id="content" class="col-full">
  25.  
  26. <!-- The slider -->
  27. <?php
  28. if ( isset( $woo_options['woo_slider'] ) && $woo_options['woo_slider'] == 'true' ) { ?>
  29. <?php $slides = get_posts('suppress_filters=0&post_type=slide&showposts='.$woo_options[ 'woo_slider_entries' ]); ?>
  30. <?php if (!empty($slides)) { ?>
  31.  
  32. <div id="slides">
  33. <ul class="slides fix">
  34.  
  35. <?php foreach($slides as $post) : setup_postdata($post); //$count++; ?>
  36.  
  37. <li id="slide-<?php echo $count; ?>" class="slide slide-id-<?php the_ID(); ?>">
  38. <?php
  39. $slide_url = get_post_meta($post->ID, 'url', true );
  40. if ( isset($slide_url) && $slide_url != '' ) { ?>
  41. <a href="<?php echo $slide_url; ?>" title="<?php the_title_attribute(); ?>">
  42. <?php } // End If Statement ?>
  43. <div class="slide-img">
  44. <?php
  45. $has_embed = woo_embed( 'width=990&key=embed&class=slide-video&id='.$post->ID );
  46. if ( $has_embed ) {
  47. echo $has_embed; // Minus 6px off the width to cater for the 3px border.
  48. } else {
  49. woo_image( 'key=image&width=990&h=&class=slide-image&link=img' );
  50. }
  51.  
  52. ?>
  53. </div>
  54. <?php if ( isset($slide_url) && $slide_url != '' ) { ?>
  55. </a>
  56. <?php } // End If Statement ?>
  57.  
  58. <div class="slide-content">
  59.  
  60. <h2 class="title">
  61. <?php if ( isset($slide_url) && $slide_url != '' ) { ?>
  62. <a href="<?php echo $slide_url; ?>" title="<?php the_title_attribute(); ?>">
  63. <?php } // End If Statement ?>
  64. <?php the_title(); ?>
  65. <?php if ( isset($slide_url) && $slide_url != '' ) { ?>
  66. </a>
  67. <?php } // End If Statement ?>
  68.  
  69. </h2>
  70.  
  71. <div class="entry">
  72. <?php the_excerpt(); ?>
  73. </div>
  74.  
  75. </div>
  76.  
  77. </li><!--/.slide-->
  78.  
  79. <?php endforeach; ?>
  80.  
  81. </ul><!-- /.slides -->
  82.  
  83. </div><!-- /#slides -->
  84.  
  85. <?php } else {
  86. $panel_error_message = __('Please add some slides in order to display the slider correctly.','woothemes');
  87. get_template_part( 'includes/panel-error' );
  88. } ?>
  89.  
  90. <?php
  91. // Slider Settings
  92. if ( isset($woo_options['woo_slider_hover']) ) { $pauseOnHover = $woo_options['woo_slider_hover']; } else { $pauseOnHover = 'false'; }
  93. if ( isset($woo_options['woo_slider_touchswipe']) ) { $touchSwipe = $woo_options['woo_slider_touchswipe']; } else { $touchSwipe = 'true'; }
  94. if ( isset($woo_options['woo_slider_speed']) ) { $slideshowSpeed = $woo_options['woo_slider_speed']; } else { $slideshowSpeed = '7000'; } // milliseconds
  95. if ( isset($woo_options['woo_fade_speed']) ) { $animationDuration = $woo_options['woo_fade_speed']; } else { $animationDuration = '600'; } // milliseconds
  96. ?>
  97. <script type="text/javascript">
  98. jQuery(window).load(function() {
  99. jQuery('#slides').flexslider({
  100. directionNav: false,
  101. touchSwipe: <?php echo $touchSwipe; ?>,
  102. pauseOnHover: <?php echo $pauseOnHover; ?>,
  103. slideshowSpeed: <?php echo $slideshowSpeed; ?>,
  104. animationDuration: <?php echo $animationDuration; ?>
  105. });
  106. jQuery('#slides').addClass('loaded');
  107. });
  108. </script>
  109. <?php }
  110. ?>
  111. <!-- /The slider -->
  112.  
  113. <!-- Recent Products -->
  114.  
  115. <?php if ( $woo_options[ 'woo_homepage_product_tabs' ] == "true" ) { ?>
  116.  
  117. <div class="woocommerce_tabs home_tabs">
  118.  
  119. <ul class="tabs">
  120. <?php if ( $woo_options[ 'woo_homepage_best_sellers' ] == "true" ) { ?>
  121. <li><a href="#tab-best-sellers"><?php _e('Best Sellers' , 'woothemes'); ?></a></li>
  122. <?php } ?>
  123. <?php if ( $woo_options[ 'woo_homepage_staff_picks' ] == "true" ) { ?>
  124. <li><a href="#tab-staff-picks"><?php _e('Staff Picks' , 'woothemes'); ?></a></li>
  125. <?php } ?>
  126. <?php if ( $woo_options[ 'woo_homepage_new_in' ] == "true" ) { ?>
  127. <li><a href="#tab-new-in"><?php _e('New In' , 'woothemes'); ?></a></li>
  128. <?php } ?>
  129. </ul>
  130.  
  131. <?php if ( $woo_options[ 'woo_homepage_best_sellers' ] == "true" ) { ?>
  132. <div class="panel" id="tab-best-sellers">
  133.  
  134. <ul class="bestselling-products products">
  135.  
  136. <?php
  137. $args = array( 'post_type' => 'product', 'posts_per_page' => 6, 'meta_key' => 'total_sales', 'orderby' => 'meta_value' );
  138. $i = 0;
  139. $loop = new WP_Query( $args );
  140. while ( $loop->have_posts() ) : $loop->the_post(); $_product = &new WC_Product( $loop->post->ID ); $i++; ?>
  141.  
  142. <li class="product <?php if ($i%3==0) echo ' last'; if (($i-1)%3==0) echo ' first'; ?>">
  143. <div class="inner">
  144. <?php woocommerce_show_product_sale_flash( $post, $_product ); ?>
  145. <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); ?>">
  146. <?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); else echo '<img src="'.woocommerce_placeholder_img_src().'" alt="Placeholder" />'; ?>
  147. <h3><?php the_title(); ?></h3>
  148. <span class="price"><?php echo $_product->get_price_html(); ?></span>
  149. </a>
  150. <?php woocommerce_template_loop_add_to_cart( $loop->post, $_product ); ?>
  151. <?php smpl_product_more_details(); ?>
  152. </div>
  153. </li>
  154.  
  155. <?php endwhile; ?>
  156.  
  157. </ul>
  158.  
  159. </div>
  160. <?php } ?>
  161.  
  162. <?php if ( $woo_options[ 'woo_homepage_staff_picks' ] == "true" ) { ?>
  163. <div class="panel" id="tab-staff-picks">
  164.  
  165. <ul class="featured-products products">
  166.  
  167. <?php
  168. $args = array( 'post_type' => 'product', 'posts_per_page' => 6, 'meta_query' => array( array('key' => '_visibility','value' => array('catalog', 'visible'),'compare' => 'IN'),array('key' => '_featured','value' => 'yes')) );
  169. $i = 0;
  170. $loop = new WP_Query( $args );
  171. while ( $loop->have_posts() ) : $loop->the_post(); $_product = &new WC_Product( $loop->post->ID ); $i++; ?>
  172.  
  173. <li class="product <?php if ($i%3==0) echo ' last'; if (($i-1)%3==0) echo ' first'; ?>">
  174. <div class="inner">
  175. <?php woocommerce_show_product_sale_flash( $post, $_product ); ?>
  176. <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); ?>">
  177. <?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); else echo '<img src="'.woocommerce_placeholder_img_src().'" alt="Placeholder" />'; ?>
  178. <h3><?php the_title(); ?></h3>
  179. <span class="price"><?php echo $_product->get_price_html(); ?></span>
  180. </a>
  181. <?php woocommerce_template_loop_add_to_cart( $loop->post, $_product ); ?>
  182. <?php smpl_product_more_details(); ?>
  183. </div>
  184. </li>
  185.  
  186. <?php endwhile; ?>
  187.  
  188. </ul>
  189.  
  190. </div>
  191. <?php } ?>
  192.  
  193. <?php if ( $woo_options[ 'woo_homepage_new_in' ] == "true" ) { ?>
  194. <div class="panel" id="tab-new-in">
  195.  
  196. <ul class="recent-products products">
  197.  
  198. <?php
  199. $args = array( 'post_type' => 'product', 'posts_per_page' => 6, 'meta_query' => array( array('key' => '_visibility','value' => array('catalog', 'visible'),'compare' => 'IN'),array('key' => '_featured','value' => 'no')) );
  200. $i = 0;
  201. $loop = new WP_Query( $args );
  202. while ( $loop->have_posts() ) : $loop->the_post(); $_product = &new WC_Product( $loop->post->ID ); $i++; ?>
  203.  
  204. <li class="product <?php if ($i%3==0) echo ' last'; if (($i-1)%3==0) echo ' first'; ?>">
  205. <div class="inner">
  206. <?php woocommerce_show_product_sale_flash( $post, $_product ); ?>
  207. <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); ?>">
  208. <?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); else echo '<img src="'.woocommerce_placeholder_img_src().'" alt="Placeholder" />'; ?>
  209. <h3><?php the_title(); ?></h3>
  210. <span class="price"><?php echo $_product->get_price_html(); ?></span>
  211. </a>
  212. <?php woocommerce_template_loop_add_to_cart( $loop->post, $_product ); ?>
  213. <?php smpl_product_more_details(); ?>
  214. </div>
  215. </li>
  216.  
  217. <?php endwhile; ?>
  218.  
  219. </ul>
  220.  
  221. </div>
  222. <?php } ?>
  223.  
  224. </div><!--/.woocommerce_tabs -->
  225.  
  226. <?php } ?>
  227.  
  228. <!-- /Recent Products -->
  229.  
  230. <!-- The latest tweet -->
  231. <?php if ( $woo_options[ 'woo_homepage_tweet' ] == "true" ) { ?>
  232. <?php smpl_tweet(); ?>
  233. <?php } ?>
  234. <!-- /The latest tweet -->
  235.  
  236. <!-- Portfolio items -->
  237. <?php if ( $woo_options[ 'woo_homepage_portfolio' ] == "true" ) { ?>
  238. <?php get_template_part( 'includes/homepage-portfolio-panel' ); ?>
  239. <?php } ?>
  240. <!-- /Porfolio items -->
  241.  
  242. <section id="main" class="col-left">
  243.  
  244. <?php
  245.  
  246. $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; query_posts( array( 'post_type' => 'post', 'paged' => $paged, 'posts_per_page' => 3 ) );
  247.  
  248. if ( have_posts() ) : $count = 0;
  249. ?>
  250.  
  251. <?php /* Start the Loop */ ?>
  252. <?php while ( have_posts() ) : the_post(); $count++; ?>
  253.  
  254. <?php
  255. /* Include the Post-Format-specific template for the content.
  256. * If you want to overload this in a child theme then include a file
  257. * called content-___.php (where ___ is the Post Format name) and that will be used instead.
  258. */
  259. get_template_part( 'content', get_post_format() );
  260. ?>
  261.  
  262. <?php endwhile; ?>
  263.  
  264. <?php else : ?>
  265.  
  266. <article <?php post_class(); ?>>
  267. <p><?php _e( 'Sorry, no posts matched your criteria.', 'woothemes' ); ?></p>
  268. </article><!-- /.post -->
  269.  
  270. <?php endif; ?>
  271.  
  272. <div class="pagination-wrap">
  273. <?php woo_pagenav(); ?>
  274. </div>
  275.  
  276. </section><!-- /#main -->
  277.  
  278. <?php get_sidebar('home'); ?>
  279.  
  280. </div><!-- /#content -->
  281.  
  282. <?php get_footer(); ?>