更改wooccommerce产品页面上的图像尺寸



我从Wooccommerce这个帖子中获得了灵感:与产品图像不同的特色图像,并在Wooccommence主题网站上制作了一个画廊页面作为产品页面上的特色图像/大图像。

然而,由于它是从缩略图库中挑选小图像,因此尺寸没有改变,因此图像变得模糊。其中的HTML限制了它。我如何在产品单页上增加主图像/大图像的宽度和高度。

为了参考,您可以访问此链接http://fliptales2.davcommdev.com/product/aaron-camel/。你可以发现图像是模糊的,这个大图像的HTML是200x159。

我还是完成了。这是代码。。(参考:Wooccommerce:特色图片不同于产品图片)

<div class="images">
<?php
    $attachment_ids = $product->get_gallery_attachment_ids();
    isset ($placeholder_width)? : $placeholder_width=0;
    isset ($placeholder_height)? : $placeholder_height=0;
    if ( $attachment_ids ) {
        $attachment_id = $attachment_ids[0];
    if ( ! $placeholder_width )
        $placeholder_width = $woocommerce->get_image_size( 'shop_catalog_image_width' );
    if ( ! $placeholder_height )
        $placeholder_height = $woocommerce->get_image_size( 'shop_catalog_image_height' );
        $output = '<div class="imagewrapper">';
        //$classes = array( 'imagewrapper' );
        $classes = array();
        $image_link = wp_get_attachment_url( $attachment_id );
        if ( $image_link ) {
        $image       = wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_large_thumbnail_size', 'shop_single' ) );
        $image_class = esc_attr( implode( ' ', $classes ) );
        $image_title = esc_attr( get_the_title( $attachment_id ) );
        echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<a href="%s" itemprop="image" class="woocommerce-main-image zoom" title="%s"  rel="prettyPhoto[product-gallery]">%s</a>', $image_link, $image_title, $image ), $post->ID );
        } else {
            echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<img src="%s" alt="Placeholder" />', woocommerce_placeholder_img_src() ), $post->ID );
        }
    }
?>
<?php do_action( 'woocommerce_product_thumbnails' ); ?>

最新更新