ID, 'product_cat' ); if ( $terms ) { $terms_print = array(); foreach ($terms as $term ) { if ( $term->parent != 0 ) { //has parent array_push( $terms_print, $term->name ); } } if ( $terms_print ) { echo '
'; echo wp_kses_post( $terms_print[0] ); //Prints the first of the child terms echo '
'; }else{ echo '
'; echo wp_kses_post( $terms[0]->name ); //Print the only term echo '
'; } }//if terms } } add_action('woocommerce_single_product_summary', 'shophistic_lite_product_category', 2); //Remove Upsell products from Single Page remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 ); /** * Hook in on activation */ /** * Define image sizes */ if (!function_exists('shophistic_lite_woocommerce_image_dimensions')) { function shophistic_lite_woocommerce_image_dimensions() { global $pagenow; if ( ! isset( $_GET['activated'] ) || $pagenow != 'themes.php' ) { return; } $catalog = array( 'width' => '348', // px 'height' => '445', // px 'crop' => 1 // true ); $single = array( 'width' => '568', // px 'height' => '725', // px 'crop' => 1 // true ); $thumbnail = array( 'width' => '78', // px 'height' => '99', // px 'crop' => 1 // true ); // Image sizes update_option( 'shop_catalog_image_size', $catalog ); // Product category thumbs update_option( 'shop_single_image_size', $single ); // Single product image update_option( 'shop_thumbnail_image_size', $thumbnail ); // Image gallery thumbs } } add_action( 'after_switch_theme', 'shophistic_lite_woocommerce_image_dimensions', 1 ); /** * Replace default thumbnail function */ if (!function_exists('shophistic_lite_template_loop_product_thumbnail')) { function shophistic_lite_template_loop_product_thumbnail() { echo woocommerce_get_product_thumbnail(); //Get one more image global $product; $attachment_ids = $product->get_gallery_attachment_ids(); if ( $attachment_ids > 0 ) { $default_attr = array( 'class' => "product_second_img" ); $image = wp_get_attachment_image( $attachment_ids[0], 'shop_catalog', false, $default_attr ); echo wp_kses_post( $image ); } } } //Replace default thumbnail function for "shophistic_lite_template_loop_product_thumbnail" remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10); add_action('woocommerce_before_shop_loop_item_title', 'shophistic_lite_template_loop_product_thumbnail', 10); /** * Remove Description tab */ add_filter( 'woocommerce_product_tabs', 'shophistic_lite_remove_product_tabs', 98 ); if ( !function_exists( 'shophistic_lite_remove_product_tabs' ) ) { function shophistic_lite_remove_product_tabs( $tabs ) { unset( $tabs['description'] ); // Remove the description tab return $tabs; } } /** * Adds the description under the 'add to cart' button */ add_action( 'woocommerce_single_product_summary', 'shophistic_lite_woocommerce_product_excerpt', 35); if (!function_exists('shophistic_lite_woocommerce_product_excerpt')){ function shophistic_lite_woocommerce_product_excerpt(){ echo '
'; the_content(); echo '
'; } } /** * Updates the total with AJAX */ if (!function_exists('shophistic_lite_header_add_to_cart_fragment')) { function shophistic_lite_header_add_to_cart_fragment( $fragments ) { ob_start(); ?>
get_attributes(); if ( ! $attributes ) { return; } $out = '
'; foreach ( $attributes as $attribute ) { if ( $attribute['is_taxonomy'] ) { $terms = wp_get_post_terms( $product->id, $attribute['name'], 'all' ); if ( !is_wp_error( $terms ) ) { // get the taxonomy $tax = $terms[0]->taxonomy; // get the tax object $tax_object = get_taxonomy($tax); // get tax label if ( isset ($tax_object->labels->name) ) { $tax_label = $tax_object->labels->name; } elseif ( isset( $tax_object->label ) ) { $tax_label = $tax_object->label; } $out .= '

'. $tax_label .'

'; $out .= ''; }//if WP_Error } else { $out .= ''; } } $out .= '
'; echo $out; } add_action( 'woocommerce_after_shop_loop_item_title', 'shophistic_lite_show_attribute', 15 ); //Remove prettyPhoto lightbox add_action( 'wp_enqueue_scripts', 'shophistic_lite_remove_woo_lightbox', 99 ); function shophistic_lite_remove_woo_lightbox() { if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) ); wp_dequeue_style( 'woocommerce_prettyPhoto_css' ); wp_dequeue_script( 'prettyPhoto' ); wp_dequeue_script( 'prettyPhoto-init' ); } } ?>