'', 'post_type' => 'product', 'paged' => $paged ) ); define('SHOP_IS_ON_FRONT', true); endif; } } add_action('wp_head', 'woocommerce_front_page_archive', 0); /** * Content Wrappers **/ if (!function_exists('woocommerce_output_content_wrapper')) { function woocommerce_output_content_wrapper() { if( get_option('template') === 'twentyeleven' ) echo '
'; else echo '
'; } } if (!function_exists('woocommerce_output_content_wrapper_end')) { function woocommerce_output_content_wrapper_end() { if( get_option('template') === 'twentyeleven' ) echo '
'; else echo ''; } } /** * Sale Flash **/ if (!function_exists('woocommerce_show_product_sale_flash')) { function woocommerce_show_product_sale_flash( $post, $_product ) { if ($_product->is_on_sale()) echo ''.__('Sale!', 'woothemes').''; } } /** * Sidebar **/ if (!function_exists('woocommerce_get_sidebar')) { function woocommerce_get_sidebar() { get_sidebar('shop'); } } /** * Products Loop **/ if (!function_exists('woocommerce_template_loop_add_to_cart')) { function woocommerce_template_loop_add_to_cart( $post, $_product ) { ?>get_price_html(); ?>is_visible() && $post->post_parent > 0) : wp_safe_redirect(get_permalink($post->post_parent)); exit; endif; if (!$_product->is_visible()) : wp_safe_redirect(home_url()); exit; endif; } } /** * Before Single Products Summary Div **/ if (!function_exists('woocommerce_show_product_images')) { function woocommerce_show_product_images() { global $_product, $post; echo '
'; $thumb_id = 0; if (has_post_thumbnail()) : $thumb_id = get_post_thumbnail_id(); $large_thumbnail_size = apply_filters('single_product_large_thumbnail_size', 'shop_single'); echo ''; the_post_thumbnail($large_thumbnail_size); echo ''; else : echo 'Placeholder'; endif; do_action('woocommerce_product_thumbnails'); echo '
'; } } if (!function_exists('woocommerce_show_product_thumbnails')) { function woocommerce_show_product_thumbnails() { global $_product, $post; echo '
'; $thumb_id = get_post_thumbnail_id(); $small_thumbnail_size = apply_filters('single_product_small_thumbnail_size', 'shop_thumbnail'); $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID ); $attachments = get_posts($args); if ($attachments) : $loop = 0; $columns = 3; foreach ( $attachments as $attachment ) : if ($thumb_id==$attachment->ID) continue; $loop++; $_post = & get_post( $attachment->ID ); $url = wp_get_attachment_url($_post->ID); $post_title = esc_attr($_post->post_title); $image = wp_get_attachment_image($attachment->ID, $small_thumbnail_size); echo ''.$image.''; endforeach; endif; wp_reset_query(); echo '
'; } } /** * After Single Products Summary Div **/ if (!function_exists('woocommerce_output_product_data_tabs')) { function woocommerce_output_product_data_tabs() { if (isset($_COOKIE["current_tab"])) $current_tab = $_COOKIE["current_tab"]; else $current_tab = '#tab-description'; ?>

get_price_html(); ?>

post_excerpt) echo wpautop(wptexturize($post->post_excerpt)); } } if (!function_exists('woocommerce_template_single_meta')) { function woocommerce_template_single_meta( $post, $_product ) { ?>
is_type('simple') && get_option('woocommerce_enable_sku')=='yes') : ?>SKU: sku; ?>.get_categories( ', ', ' Posted in ', '.'); ?>get_tags( ', ', ' Tagged as ', '.'); ?>
'; endif; } } /** * Product Add to cart buttons **/ if (!function_exists('woocommerce_template_single_add_to_cart')) { function woocommerce_template_single_add_to_cart( $post, $_product ) { do_action( $_product->product_type . '_add_to_cart' ); } } if (!function_exists('woocommerce_simple_add_to_cart')) { function woocommerce_simple_add_to_cart() { global $_product; $availability = $_product->get_availability(); if ($availability['availability']) : ?>

get_availability(); if ($availability['availability']) : ?>

children as $child) : $child_product = &new woocommerce_product( $child->ID ); $cavailability = $child_product->get_availability(); ?>
get_price_html(); ?>
get_available_attribute_variations(); // Put available variations into an array and put in a Javascript variable (JSON encoded) $available_variations = array(); $children = $_product->get_children(); foreach($children as $child) { $variation = $child->product; if($variation instanceof woocommerce_product_variation) { if ($variation->variation->post_status != 'publish') continue; // Disabled $variation_attributes = $variation->get_variation_attributes(); $availability = $variation->get_availability(); $availability_html = (!empty($availability['availability'])) ? '

'. $availability['availability'].'

' : ''; if (has_post_thumbnail($variation->get_variation_id())) { $attachment_id = get_post_thumbnail_id( $variation->get_variation_id() ); $large_thumbnail_size = apply_filters('single_product_large_thumbnail_size', 'shop_single'); $image = current(wp_get_attachment_image_src( $attachment_id, $large_thumbnail_size )); $image_link = current(wp_get_attachment_image_src( $attachment_id, 'full' )); } else { $image = ''; $image_link = ''; } $available_variations[] = array( 'variation_id' => $variation->get_variation_id(), 'attributes' => $variation_attributes, 'image_src' => $image, 'image_link' => $image_link, 'price_html' => ''.$variation->get_price_html().'', 'availability_html' => $availability_html, ); } } ?>
$options) :?>
max_num_pages > 1 ) : ?>
  • >
  • has_attributes()) : ?>
  • >
  • >
  • '; echo '

    ' . apply_filters('woocommerce_product_description_heading', __('Product Description', 'woothemes')) . '

    '; the_content(); echo ''; } } if (!function_exists('woocommerce_product_attributes_panel')) { function woocommerce_product_attributes_panel() { global $_product; echo '
    '; echo '

    ' . apply_filters('woocommerce_product_description_heading', __('Additional Information', 'woothemes')) . '

    '; $_product->list_attributes(); echo '
    '; } } if (!function_exists('woocommerce_product_reviews_panel')) { function woocommerce_product_reviews_panel() { echo '
    '; comments_template(); echo '
    '; } } /** * WooCommerce Product Thumbnail **/ if (!function_exists('woocommerce_get_product_thumbnail')) { function woocommerce_get_product_thumbnail( $size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0 ) { global $post; if (!$placeholder_width) $placeholder_width = woocommerce::get_var('shop_single_image_width'); if (!$placeholder_height) $placeholder_height = woocommerce::get_var('shop_single_image_height'); if ( has_post_thumbnail() ) return get_the_post_thumbnail($post->ID, $size); else return 'Placeholder'; } } /** * WooCommerce Related Products **/ if (!function_exists('woocommerce_output_related_products')) { function woocommerce_output_related_products() { // 4 Related Products in 4 columns woocommerce_related_products( 2, 2 ); } } if (!function_exists('woocommerce_related_products')) { function woocommerce_related_products( $posts_per_page = 4, $post_columns = 4, $orderby = 'rand' ) { global $_product, $columns, $per_page; // Pass vars to loop $per_page = $posts_per_page; $columns = $post_columns; $related = $_product->get_related(); if (sizeof($related)>0) : echo ''; endif; wp_reset_query(); } } /** * WooCommerce Shipping Calculator **/ if (!function_exists('woocommerce_shipping_calculator')) { function woocommerce_shipping_calculator() { if (woocommerce_shipping::$enabled && get_option('woocommerce_enable_shipping_calc')=='yes' && woocommerce_cart::needs_shipping()) : ?>

    ', $wrap_after = '', $before = '', $after = '', $home = null ) { global $post, $wp_query, $author, $paged; if( !$home ) $home = _x('Home', 'breadcrumb', 'woothemes'); $home_link = home_url(); $prepend = ''; if ( get_option('woocommerce_prepend_shop_page_to_urls')=="yes" && get_option('woocommerce_shop_page_id') && get_option('page_on_front') !== get_option('woocommerce_shop_page_id') ) $prepend = $before . '' . get_the_title( get_option('woocommerce_shop_page_id') ) . ' ' . $after . $delimiter; if ( (!is_home() && !is_front_page() && !(is_post_type_archive() && get_option('page_on_front')==get_option('woocommerce_shop_page_id'))) || is_paged() ) : echo $wrap_before; echo $before . '' . $home . ' ' . $after . $delimiter ; if ( is_category() ) : $cat_obj = $wp_query->get_queried_object(); $this_category = $cat_obj->term_id; $this_category = get_category( $this_category ); if ($thisCat->parent != 0) : $parent_category = get_category( $this_category->parent ); echo get_category_parents($parent_category, TRUE, $delimiter ); endif; echo $before . single_cat_title('', false) . $after; elseif ( is_tax('product_cat') ) : //echo $before . '' . ucwords(get_option('woocommerce_shop_slug')) . '' . $after . $delimiter; $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); $parents = array(); $parent = $term->parent; while ($parent): $parents[] = $parent; $new_parent = get_term_by( 'id', $parent, get_query_var( 'taxonomy' )); $parent = $new_parent->parent; endwhile; if(!empty($parents)): $parents = array_reverse($parents); foreach ($parents as $parent): $item = get_term_by( 'id', $parent, get_query_var( 'taxonomy' )); echo $before . '' . $item->name . '' . $after . $delimiter; endforeach; endif; $queried_object = $wp_query->get_queried_object(); echo $prepend . $before . $queried_object->name . $after; elseif ( is_tax('product_tag') ) : $queried_object = $wp_query->get_queried_object(); echo $prepend . $before . __('Products tagged “', 'woothemes') . $queried_object->name . '”' . $after; elseif ( is_day() ) : echo $before . '' . get_the_time('Y') . '' . $after . $delimiter; echo $before . '' . get_the_time('F') . '' . $after . $delimiter; echo $before . get_the_time('d') . $after; elseif ( is_month() ) : echo $before . '' . get_the_time('Y') . '' . $after . $delimiter; echo $before . get_the_time('F') . $after; elseif ( is_year() ) : echo $before . get_the_time('Y') . $after; elseif ( is_post_type_archive('product') && get_option('page_on_front') !== get_option('woocommerce_shop_page_id') ) : $_name = get_option('woocommerce_shop_page_id') ? get_the_title( get_option('woocommerce_shop_page_id') ) : ucwords(get_option('woocommerce_shop_slug')); if (is_search()) : echo $before . '' . $_name . '' . $delimiter . __('Search results for “', 'woothemes') . get_search_query() . '”' . $after; else : echo $before . '' . $_name . '' . $after; endif; elseif ( is_single() && !is_attachment() ) : if ( get_post_type() == 'product' ) : //echo $before . '' . ucwords(get_option('woocommerce_shop_slug')) . '' . $after . $delimiter; echo $prepend; if ($terms = wp_get_object_terms( $post->ID, 'product_cat' )) : $term = current($terms); $parents = array(); $parent = $term->parent; while ($parent): $parents[] = $parent; $new_parent = get_term_by( 'id', $parent, 'product_cat'); $parent = $new_parent->parent; endwhile; if(!empty($parents)): $parents = array_reverse($parents); foreach ($parents as $parent): $item = get_term_by( 'id', $parent, 'product_cat'); echo $before . '' . $item->name . '' . $after . $delimiter; endforeach; endif; echo $before . '' . $term->name . '' . $after . $delimiter; endif; echo $before . get_the_title() . $after; elseif ( get_post_type() != 'post' ) : $post_type = get_post_type_object(get_post_type()); $slug = $post_type->rewrite; echo $before . '' . $post_type->labels->singular_name . '' . $after . $delimiter; echo $before . get_the_title() . $after; else : $cat = current(get_the_category()); echo get_category_parents($cat, TRUE, $delimiter); echo $before . get_the_title() . $after; endif; elseif ( is_404() ) : echo $before . __('Error 404', 'woothemes') . $after; elseif ( !is_single() && !is_page() && get_post_type() != 'post' ) : $post_type = get_post_type_object(get_post_type()); if ($post_type) : echo $before . $post_type->labels->singular_name . $after; endif; elseif ( is_attachment() ) : $parent = get_post($post->post_parent); $cat = get_the_category($parent->ID); $cat = $cat[0]; echo get_category_parents($cat, TRUE, '' . $delimiter); echo $before . '' . $parent->post_title . '' . $after . $delimiter; echo $before . get_the_title() . $after; elseif ( is_page() && !$post->post_parent ) : echo $before . get_the_title() . $after; elseif ( is_page() && $post->post_parent ) : $parent_id = $post->post_parent; $breadcrumbs = array(); while ($parent_id) { $page = get_page($parent_id); $breadcrumbs[] = '' . get_the_title($page->ID) . ''; $parent_id = $page->post_parent; } $breadcrumbs = array_reverse($breadcrumbs); foreach ($breadcrumbs as $crumb) : echo $crumb . '' . $delimiter; endforeach; echo $before . get_the_title() . $after; elseif ( is_search() ) : echo $before . __('Search results for “', 'woothemes') . get_search_query() . '”' . $after; elseif ( is_tag() ) : echo $before . __('Posts tagged “', 'woothemes') . single_tag_title('', false) . '”' . $after; elseif ( is_author() ) : $userdata = get_userdata($author); echo $before . __('Author: ', 'woothemes') . $userdata->display_name . $after; endif; if ( get_query_var('paged') ) : echo ' (' . __('Page', 'woothemes') . ' ' . get_query_var('paged') .')'; endif; echo $wrap_after; endif; } } /** * Remove the singular class for woocommerce single product **/ function woocommerce_body_classes ($classes) { if( ! is_singular('product') ) return $classes; $key = array_search('singular', $classes); if ( $key !== false ) unset($classes[$key]); return $classes; } /** * Display Up Sells **/ function woocommerce_upsell_display() { global $_product; $upsells = $_product->get_upsells(); if (sizeof($upsells)>0) : echo '

    '.__('You may also like…', 'woothemes').'

    '; endif; wp_reset_query(); } /** * Display Cross Sells **/ function woocommerce_cross_sell_display() { global $columns; $columns = 2; $crosssells = woocommerce_cart::get_cross_sells(); if (sizeof($crosssells)>0) : echo '

    '.__('You may be interested in…', 'woothemes').'

    '; $args = array( 'post_type' => 'product', 'ignore_sticky_posts' => 1, 'posts_per_page' => 2, 'orderby' => 'rand', 'post__in' => $crosssells ); query_posts($args); woocommerce_get_template_part( 'loop', 'shop' ); echo '
    '; endif; wp_reset_query(); } /** * Order review table for checkout **/ function woocommerce_order_review() { woocommerce_get_template('checkout/review_order.php', false); }