'; }, -99 ); add_action( 'woocommerce_single_product_summary', function(){ echo ''; }, 99 ); add_filter( 'woocommerce_gallery_image_size', function(){ return 'woocommerce_single'; } ); } if( 'gallery-showcase' === $single_product_gallery ) { remove_theme_support( 'wc-product-gallery-zoom' ); add_action( 'woocommerce_single_product_summary', function(){ echo '
'; }, -99 ); add_action( 'woocommerce_single_product_summary', function(){ echo '
'; }, 99 ); } if( 'gallery-full-width' === $single_product_gallery ) { remove_theme_support( 'wc-product-gallery-zoom' ); add_action( 'woocommerce_single_product_summary', function(){ echo ''; }, 99 ); } } add_action( 'wp', 'botiga_single_product_gallery_hooks' ); /** * Preload main product image. * * @return void */ function botiga_single_product_preload_image() { global $post; if ( ! $post ) { return; } if ( ! is_singular( 'product' ) ) { return; } $product = wc_get_product( $post ); $main_image_id = $product->get_image_id(); if ( ! $main_image_id ) { return; } $image_src = wp_get_attachment_image_src( $main_image_id, 'full' ); $image_srcset = wp_get_attachment_image_srcset( $main_image_id, 'full' ); $image_sizes = wp_get_attachment_image_sizes( $main_image_id, 'full' ); if ( ! $image_src || ! $image_srcset || ! $image_sizes ) { return; } echo ''; } /** * Single product top area wrapper */ function botiga_single_product_wrap_before() { $classes = array( 'product-gallery-summary' ); // Gallery layout. $classes[] = get_theme_mod( 'single_product_gallery', 'gallery-default' ); // Thumbs slider. $classes[] = get_theme_mod( 'single_gallery_slider', 1 ) ? 'has-thumbs-slider' : 'has-thumbs-grid'; // Output. echo '
'; } add_action( 'woocommerce_before_single_product_summary', 'botiga_single_product_wrap_before', -99 ); /** * Single product top area wrapper */ function botiga_single_product_wrap_after() { echo '
'; } add_action( 'woocommerce_after_single_product_summary', 'botiga_single_product_wrap_after', 9 ); /** * Filter single product Flexslider options */ function botiga_product_carousel_options( $options ) { $layout = get_theme_mod( 'single_product_gallery', 'gallery-default' ); if ( 'gallery-single' === $layout ) { $options['controlNav'] = false; $options['directionNav'] = true; } if ( 'gallery-showcase' === $layout || 'gallery-full-width' === $layout ) { $options['controlNav'] = 'thumbnails'; $options['directionNav'] = true; } return $options; } add_filter( 'woocommerce_single_product_carousel_options', 'botiga_product_carousel_options' );