小编Bar*_*yst的帖子

如何获得Wordpress image_size网址

我正在将Woocommerce用于1800多个产品电子商店.Woocommerce附带一个内置的PrettyPhoto灯箱插件.默认情况下,当您单击以缩放灯箱中的图像时,它会加载原始Wordpress图像大小.

Woocommerce在模板'product-image.php'中调用此原始图像.我可以修改那个.变量$ image_link调用原始大小.我想打电话给我已经制作的自定义尺寸.我只是不知道怎么称呼它,我在文档,论坛和网站上找了一天但找不到它.

我需要修改$ image_link,以便调用我的自定义图像大小(我通过add_image_size添加).但是怎么样?我知道这是Wordpress的基础知识,但我无法完成它...

我的网站示例(点击放大,它显示1600px宽图像的缩小图像,但我想要一个较小的图像):http://www.affichesmarci.com/shop/the-railys-cycling-act/

<?php
    if ( has_post_thumbnail() ) {

        $image              = get_the_post_thumbnail( $post->ID, apply_filters( 'single_product_large_thumbnail_size', 'shop_single' ) );

        $image_title        = esc_attr( get_the_title( get_post_thumbnail_id() ) );
        $image_link         = wp_get_attachment_url( get_post_thumbnail_id() );

        $attachment_count   = count( $product->get_gallery_attachment_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="bigbox woocommerce-main-image zoom" title="%s" rel="prettyPhoto' . $gallery . '">%s</a>', $image_link, $image_title, $image ), $post->ID ); …
Run Code Online (Sandbox Code Playgroud)

wordpress thumbnails prettyphoto woocommerce

1
推荐指数
1
解决办法
8814
查看次数

标签 统计

prettyphoto ×1

thumbnails ×1

woocommerce ×1

wordpress ×1