$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>functions - Woocommerce image sizes missing from Appearance › Customize but not declared by theme|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

functions - Woocommerce image sizes missing from Appearance › Customize but not declared by theme

matteradmin11PV0评论

I would like to resize the 100px x 100px store thumbnail images.

The sizes are supposed to be set under Appearance › Customize › WooCommerce › Product Images

These size settings are missing.

After an exhaustive search, it is obvious that the sizes only appear there if they are not set in functions.php in the theme via (for example):

add_theme_support( 'woocommerce', array(
    'thumbnail_image_width'         => 200,
    'gallery_thumbnail_image_width' => 100,
    'single_image_width'            => 500,
) );

However, I am using theme Twenty Fifteen, WooCommerce 3.5.5, and Elementor.

The above code is not in the theme.

I have tried disabling all plugins except WooCommerce.

I have tried several different themes, none of which include the add_theme_support code.

Why are the custom images sizes not available?

I would like to avoid having to add code… I'm a programmer but I'm going to be building a bunch of WP/WC sites in the next few months and it would be nice to avoid having to modify the theme or the WP installation for every site.

I would like to resize the 100px x 100px store thumbnail images.

The sizes are supposed to be set under Appearance › Customize › WooCommerce › Product Images

These size settings are missing.

After an exhaustive search, it is obvious that the sizes only appear there if they are not set in functions.php in the theme via (for example):

add_theme_support( 'woocommerce', array(
    'thumbnail_image_width'         => 200,
    'gallery_thumbnail_image_width' => 100,
    'single_image_width'            => 500,
) );

However, I am using theme Twenty Fifteen, WooCommerce 3.5.5, and Elementor.

The above code is not in the theme.

I have tried disabling all plugins except WooCommerce.

I have tried several different themes, none of which include the add_theme_support code.

Why are the custom images sizes not available?

I would like to avoid having to add code… I'm a programmer but I'm going to be building a bunch of WP/WC sites in the next few months and it would be nice to avoid having to modify the theme or the WP installation for every site.

Share Improve this question asked Mar 7, 2019 at 10:25 Andrew SwiftAndrew Swift 1013 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 1

WooCommerce itself registers support for the default themes. For Twenty Fifteen it registers the following:

add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
add_theme_support( 'woocommerce', array(
    'thumbnail_image_width' => 200,
    'single_image_width'    => 350,
) );

This is why those settings are not in the Customiser.

However, regardless of what theme support is registered, the gallery_thumbnail_image_width size is never editable in the Customiser.

These default settings were chosen for a reason though, so if you need to change them then that suggests you're changing the theme in some way, in which case you should be working on a child theme, rather than modifying the original theme. In that case your child theme should register its own support for WooCommerce. Then you can either omit the values so that the settings appear in the Customiser, or set your own.

I found the following plugin, which worked to resize the gallery thumbnails:

custom-image-sizes-for-woocommerce.zip

available at https://cld.wthms.co/O4lsZz

The plugin restores the ability to change image sizes under Appearance › Customize › WooCommerce › Product Images

It was necessary to use the Regenerate Thumbnails plugin after changing the image sizes.

Post a comment

comment list (0)

  1. No comments so far