Home WooCommerce Tutorials Standard Post

Standard Post

Modify the Number of Images in WooCommerce Product Gallery

By default, WordPress uses WooCommerce to upload products. The product gallery displays 4 images. If you want to display more product images in one row, you can add the following code to the theme functions file. // Adjust the number of product gallery images per row add_filter( 'woocommerce_prod...

Published on May 12, 2022 About 1 minute read

By default, when using WooCommerce to upload products in WordPress, the product gallery displays 4 images. If you want to display more product images in a row, you can add the following code to your theme's functions file.

// 调整产品图册单排展示数量
add_filter( 'woocommerce_product_thumbnails_columns', create_function( '', 'return 4;' ) );

Just change the 4 in the above code to the number of images you want to display.

After modification, different themes may require additional CSS adjustments. There is no universal code for this; it needs to be adjusted based on your website's actual situation.

2.5/5 - (15 votes)
Previous Tutorial: Building a Paid Application Resource Download Site with WordPress + Astore Continue reading content around the same timeline. Next Lightweight WordPress Optimization Plugin Recommendation: Performance 1.9.1 (with download link) View the next related tutorial or experience.

AI Website Building Assistant

🤖
Hello! I am the Naibabiji AI Assistant. How can I help you?
Quick Consultation: