官术网_书友最值得收藏!

  • WooCommerce Cookbook
  • Patrick Rauland
  • 506字
  • 2021-07-23 19:35:07

Changing image sizes in WooCommerce

If your products fit nicely into perfectly square images and they look good as they are in your theme, then you can probably skip this recipe. For some themes or some types of products, though, it's really beneficial to change how WooCommerce crops your images. If you're selling ties, for example, it's probably worth telling WooCommerce to crop them so they're long and skinny.

Getting ready

It's best if you have already created a couple of products and look at them to compare how the Featured Image and the Product Gallery look on their product pages. If you see gaps around the images, you may be able to increase the product image size and take advantage of that space.

How to do it…

Changing image sizes can be done in two parts. The first part will change the settings, and this will affect all future uploads. The second part will install a plugin that will force your website to recrop every image, which will affect all past uploads. Let's have a look at the following steps that depict these two parts:

  1. From the WordPress admin, go to WooCommerce | Settings.
  2. Click on the Products tab.
  3. Click on the Display tab and then scroll down to Product Image Sizes.
    How to do it…
  4. Enter your new sizes.
  5. Catalog Images controls the size on the shop page and category pages.
  6. Single Product Image controls the size of the featured image on the product page.
  7. Product Thumbnails controls the size of the gallery thumbnails on the product page.
  8. When you're done, click on the Save changes button at the bottom of the page.

Now that you have the new images set, any future uploads will use those settings. We'll have to install a free plugin to resize all of the existing images. Let's have a look at the following steps that illustrate the step-by-step installation of this plugin:

  1. Add a new plugin under Plugins | Add New.
  2. Run a search for, and install and activate, the Regenerate Thumbnails plugin.
  3. Click on Tools | Regen. Thumbnails.
  4. Click on Regenerate All Thumbnails and wait for your site to process all of the images.

You should now be able to go back to any of your product pages and see the new image size. In my case, I made the main featured image tall and skinny by setting Single Product Image to 150 x 300.

How to do it…

We are now done with changing the image sizes for your products.

Tip

You might be able to see a little bit of distortion in my image. That's because I uploaded an image that's too small. WooCommerce blew it up to fit the dimensions I specified. If you don't want to have blurry images, the best piece of advice is to upload high-quality large images. You can also follow this video tutorial at http://docs.woothemes.com/document/using-the-appropriate-product-image-dimensions/. If you want to learn more about the different ways you can crop images and what the different types of cropping are, there is a great article on WPExplorer at http://www.wpexplorer.com/wordpress-image-crop-sizes/.

主站蜘蛛池模板: 无极县| 台东市| 玉山县| 思茅市| 黔南| 湟源县| 扎囊县| 名山县| 和平县| 遵义县| 马边| 望都县| 琼中| 永清县| 新津县| 新化县| 沁源县| 天门市| 龙井市| 中卫市| 广水市| 鄂托克旗| 类乌齐县| 确山县| 磐石市| 桦川县| 瓮安县| 涡阳县| 宜州市| 长顺县| 和田市| 宜兰市| 江源县| 西乌珠穆沁旗| 景宁| 三河市| 临城县| 额济纳旗| 枣强县| 大荔县| 柳河县|