Created by
Alexandr Kostyrka
| /* -------------------------------------------------------
You can add your custom functions below
-------------------------------------------------------- */
function custom_polo_shop_product_images() {
global $post, $product;
$image_sizes = get_option( 'shop_catalog_image_size' );
$image_width = isset($image_sizes['width']) ? $image_sizes['width'] : 380;
$image_height = isset($image_sizes['height']) ? $image_sizes['height'] : 507;
$crop = isset($image_sizes['crop']) ? $image_sizes['crop'] : true;
$attachment_ids = $product->get_gallery_attachment_ids();
$output = '';
if ( has_post_thumbnail() ) {
$product_thumbnail = wp_get_attachment_url( get_post_thumbnail_id() );
} else {
$product_thumbnail = wc_placeholder_img_src();
}
$output .= '<a href="' . get_the_permalink( $post->ID ) . '"><img src="' . esc_url( polo_theme_thumb( $product_thumbnail, $image_width, $image_height, $crop ) ) . '" alt=""></a>';
if ( ! empty( $attachment_ids ) ) {
$image_link = wp_get_attachment_url( $attachment_ids[0] );
$output .= '<a href="' . get_the_permalink( $post->ID ) . '"><img src="' . esc_url( polo_theme_thumb( $image_link, $image_width, $image_height, $crop ) ) . '" alt=""></a>';
} else {
$output .= '<a href="' . get_the_permalink( $post->ID ) . '"><img src="' . esc_url( polo_theme_thumb( $product_thumbnail, $image_width, $image_height, $crop ) ) . '" alt=""></a>';
}
echo $output;
}
function polo_change_shop_images(){
remove_action( 'polo_woo_shop_product_images', 'polo_shop_product_images', 5 );
add_action('polo_woo_shop_product_images', 'custom_polo_shop_product_images', 5);
add_action('polo_woo_shop_product_summary', 'woocommerce_template_loop_add_to_cart', 40);
}
add_action('init','polo_change_shop_images');
|