本文介绍了需要更改[product_categories] Woocommerce短代码缩略图的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在具有Aurum主题(实验室)的网站中,我使用[product_categories] Woocommerce简码来显示父级子类别的网格.

In a site with Aurum Theme (Laborator) I use [product_categories] Woocommerce shortcode for display a grid of sub-categories of a parent.

我在外观">自定义">"Woocommerce">产品图像"中设置缩略图的大小.不同的帖子说设置此大小会影响产品缩略图和类别缩略图,但是当我更改此值时,带有简码的页面上什么都不会发生.

I set the size of thumbnails in "Appearance" > "Customize" > "Woocommerce" > "Product images".Different posts say that set this size affects both product thumbnails and categories thumbnails, but when I change this value nothing happens on the page with the shortcode.

在哪里只能更改缩略图大小类别的值?我想为所有缩略图设置1:1尺寸.有人可以帮我吗?

Where can I change the values only for categories of thumbnails sizes?I would like to set 1:1 size for all thumbnails.Can someone help me?

推荐答案

add_filter( 'woocommerce_get_image_size_thumbnail', function( $size ) {
    return array(
        'width'  => 150,
        'height' => 150,
        'crop'   => 1,
    );
} );

尝试将其添加到活动主题 functions.php 文件

Try adding this to your active theme functions.php file

这篇关于需要更改[product_categories] Woocommerce短代码缩略图的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 21:18