%PDF- %PDF-
Direktori : /var/www/html/shaban/laviva/wp-content/themes/levelup/woocommerce/single-product/ |
Current File : /var/www/html/shaban/laviva/wp-content/themes/levelup/woocommerce/single-product/product-image.php |
<?php /** * Single Product Image * * This template can be overridden by copying it to yourtheme/woocommerce/single-product/product-image.php. * * HOWEVER, on occasion WooCommerce will need to update template files and you * (the theme developer) will need to copy the new files to your theme to * maintain compatibility. We try to do this as little as possible, but it does * happen. When this occurs the version of the template file will be bumped and * the readme will list any important changes. * * @see https://docs.woocommerce.com/document/template-structure/ * @package WooCommerce/Templates * @version 3.5.1 */ defined( 'ABSPATH' ) || exit; // Note: `wc_get_gallery_image_html` was added in WC 3.3.2 and did not exist prior. This check protects against theme overrides being used on older versions of WC. if ( ! function_exists( 'wc_get_gallery_image_html' ) ) { return; } global $post, $product; $levelup_attachment_ids = $product->get_gallery_image_ids(); wp_enqueue_script( 'magnific_popup' ); wp_enqueue_style( 'magnific_popup' ); $columns = apply_filters( 'woocommerce_product_thumbnails_columns', 4 ); $post_thumbnail_id = $product->get_image_id(); $thumbnail_size = apply_filters( 'woocommerce_product_thumbnails_large_size', 'full' ); $full_size_image = wp_get_attachment_image_src( $post_thumbnail_id, $thumbnail_size ); $wrapper_classes = apply_filters( 'woocommerce_single_product_image_gallery_classes', array( 'woocommerce-product-gallery', 'woocommerce-product-gallery--' . ( has_post_thumbnail() ? 'with-images' : 'without-images' ), 'woocommerce-product-gallery--columns-' . absint( $columns ), 'images', 'col-lg-6', 'col-md-6', 'col-sm-6', 'col-xs-12', ) ); ?> <div class="<?php echo esc_attr( implode( ' ', array_map( 'sanitize_html_class', $wrapper_classes ) ) ); ?>" data-columns="<?php echo esc_attr( $columns ); ?>" style="opacity: 0; transition: opacity .25s ease-in-out;"> <?php if ( in_array( 'cloud-zoom-for-woocommerce/index.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { ?> <div class="images"> <?php if ( has_post_thumbnail() ) { $levelup_image_caption = get_post( get_post_thumbnail_id() )->post_excerpt; $levelup_image_link = wp_get_attachment_url( get_post_thumbnail_id() ); $levelup_image = get_the_post_thumbnail( $post->ID, apply_filters( 'single_product_large_thumbnail_size', 'shop_single' ), array( 'title' => get_the_title( get_post_thumbnail_id() ) ) ); $attachment_count = count( $product->get_gallery_image_ids() ); if ( $attachment_count > 0 ) { $gallery = '[product-gallery]'; } else { $gallery = ''; } echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<a href="%s" itemprop="image" class="woocommerce-main-image zoom" title="%s" data-rel="prettyPhoto' . $gallery . '">%s</a>', $levelup_image_link, $levelup_image_caption, $levelup_image ), $post->ID ); } else { echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<img src="%s" alt="%s" />', wc_placeholder_img_src(), esc_html__( 'Placeholder', 'LEVELUP' ) ), $post->ID ); } ?> <?php do_action( 'woocommerce_product_thumbnails' ); ?> </div> <?php } else { ?> <?php $levelup_thumbnail_id = get_post_thumbnail_id( $post->ID ); $levelup_thumbnail_img = wp_get_attachment_image_src( $levelup_thumbnail_id, 'shop_single' ); ?> <div class="rdy_images"> <div id="woo-images1" class='<?php if ( $levelup_attachment_ids ) :?>owl-carousel <?php endif;?>product-big-image arrows-at-hover slider product_images'> <?php if ( has_post_thumbnail() ) { $attributes = array( 'title' => get_post_field( 'post_title', $post_thumbnail_id ), 'data-caption' => get_post_field( 'post_excerpt', $post_thumbnail_id ), 'data-src' => $full_size_image[0], 'data-large_image' => $full_size_image[0], 'data-large_image_width' => $full_size_image[1], 'data-large_image_height' => $full_size_image[2], ); $levelup_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), false, '' ); $attachment_count = count( get_children( array( 'post_parent' => $post->ID, 'post_mime_type' => 'image', 'post_type' => 'attachment' ) ) ); $html = '<div data-thumb="' . get_the_post_thumbnail_url( $post->ID, 'shop_thumbnail' ) . '" class="woocommerce-product-gallery__image item easyzoom"><a href="' . esc_url( $levelup_src[0] ) . '">'; $html .= get_the_post_thumbnail( $post->ID, 'shop_single' ); $html .= '</a></div>'; echo apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, get_post_thumbnail_id( $post->ID ) ); } if ( $levelup_attachment_ids ) { $loop = 0; $columns = apply_filters( 'woocommerce_product_thumbnails_columns', 3 ); foreach ( $levelup_attachment_ids as $attachment_id ) { $classes = array( 'zoom' ); if ( $loop == 0 || $loop % $columns == 0 ) $classes[] = 'first'; if ( ( $loop + 1 ) % $columns == 0 ) $classes[] = 'last'; $levelup_image_link = wp_get_attachment_url( $attachment_id ); if ( ! $levelup_image_link ) continue; if (get_option( 'woocommerce_enable_lightbox' ) == "yes") { printf( '<div class="item easyzoom"><a href="%s" itemprop="image"><span>%s</span></a></div>', wp_get_attachment_url( $attachment_id ), wp_get_attachment_image( $attachment_id, 'shop_single' ) ); } else { printf( '<div class="item easyzoom"><a href="%s" itemprop="image"><span>%s</span></a></div>', wp_get_attachment_url( $attachment_id ), wp_get_attachment_image( $attachment_id, 'shop_single' ) ); } $loop++; } } ?> </div> <?php if ( $levelup_attachment_ids ) { ?> <div class="product_thumbs"> <ul id="woo-images2" class='flex-control-nav owl-carousel slider woo_thumbs_slider'> <?php if ( has_post_thumbnail() ) { ?> <li class="button"><div itemprop="image"><?php echo get_the_post_thumbnail( $post->ID, 'shop_thumbnail' ) ?></div></li> <?php } ?> <?php $loop = 0; $columns = apply_filters( 'woocommerce_product_thumbnails_columns', 3 ); foreach ( $levelup_attachment_ids as $attachment_id ) { $classes = array( 'zoom' ); if ( $loop == 0 || $loop % $columns == 0 ) $classes[] = 'first'; if ( ( $loop + 1 ) % $columns == 0 ) $classes[] = 'last'; $levelup_image_link = wp_get_attachment_url( $attachment_id ); if ( ! $levelup_image_link ) continue; $levelup_image = wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_small_thumbnail_size', 'shop_thumbnail' ) ); $levelup_image_class = esc_attr( implode( ' ', $classes ) ); $levelup_image_title = esc_attr( get_the_title( $attachment_id ) ); echo apply_filters( 'woocommerce_single_product_image_thumbnail_html', sprintf( '<div class="button">%s</div>', $levelup_image ), $attachment_id, $post->ID, $levelup_image_class ); $loop++; } if ($loop < 4) { for ($i=1; $i<(4-$loop); $i++) { ?> <div class="button"><!-- empty placeholder --></div> <?php } } ?> </ul> </div> <?php } ?> </div> <?php } ?> </div>