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();
?>