0

In case my recent questions have not made it abundantly clear, I am trying my hand at theme creation. Among the many other things that I am still figuring out are image sizes. Specifically add_image_size(...). I know I can use it to tell WordPress the sizes to make default images and so forth. Can I do that with an asset in my theme?

In my theme, I have an assets folder which contains a 1200x1200 image for use as a default in a range of cases. One part of my theme calls for images 140x140. Now, I could push that huge file into the src for an image but it would be kinder on page load times if I resized it.

The do it myself hack would be to open GIMP and make one image for every size I can possibly imagine wanting.

Given I'm changing things all the time, I would rather let WordPress do that for me. Can I do that? If so how?

1 Answer 1

0

Images sizes are only relevant for uploads in the media library. If you have assets in your theme then you need to include whichever sizes are needed for how they're used in the theme.

Since end users can't choose your theme's bundled images to place wherever they want, you don't need every possible size. You'll only need the sizes that you use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.