• Skip to primary navigation
  • Skip to main content
OsomCode

OsomCode

Awesome code tutorials for WordPress and Genesis

  • Subscribe
  • My account
    • Edit profile
    • Favorites
    • Update credit card
  • Login

Resize the image of Easy Digital Downloads products

Learn in this tutorial how to change the image size of Easy Digital Downloads (EDD) products using code.

If you are using Easy Digital Downloads you may have noticed that product images sometimes look a bit pixelated, especially if you use custom styles.

This is because, by default, EDD uses the thumbnail size which is 150 x 150 pixels (px) images. So if you want to display the products, for example, in a grid of 250px each column, you should change the default size.

Is this your case? Here’s how to do it:

Snippet to change the image size of Easy Digital Downloads downloads

First of all, create a folder called edd_templates in the root of your theme. Then create inside it a file called shortcode-download.php with the following code.

To see this and another 847 code snippets of this website, login or subscribe here.

In this case, what you get is to display the WordPress mediumsize which by default is 300 x 300 pixels.

But you can also use other sizes of plugins or themes, even add a default image when the product does not have one.

To do this, you can use a code like the following:

To see this and another 847 code snippets of this website, login or subscribe here.

In this case, you tell it to use the gb-block-post-grid-landscape size if Genesis Blocks is active, and if not, to use the medium size.

In addition, you indicate that if the product does not have an image, it should load one. In the example it will load the placeholder.jpg image that is in the /images/ folder inside the theme, but you can adjust it to your liking.

If you want to know what are the image sizes of your WordPress installation you can follow this tutorial.

Conclusions

Do you want to customize the image size that Easy Digital Downloads uses for its products? Now you know how to do it easily using code.

If you have any question, please leave it in the comments. And if you want to give me a suggestion for future snippets, please send it through the contact form.

Benefits of being a subscriber. 🙂

CPT Easy Digital Downloads PHP

To leave read and make questions about this code, you can login or register.

  • About OsomCode
  • FAQ
  • Contact

Legal Notice · Privacy Policy · Cookie Policy · Terms and conditions
Copyright © 2023

Lost your password?