cardcodez
cardcodez

Reputation: 3

Custom image size WordPress

I'm building a custom blog listing page for a Wordpress site and trying to use a custom image size. The height of the images should be a hard 300px. All images are taller than this, so not worried about smaller images.

The width I would like to be 500px. This is where I'm having issues. I'm trying to use the Wordpress add_image_size function for this, but I keep getting a crop of exact dimensions.

Example, I use the following code, and it gives me an exact 300x300 pixel image:

add_image_size( 'blog-two', 500, 300);

I've even tried adding the hard crop value to this and not getting the desired result of a 500x300 pixel cropped image.

add_image_size( 'blog-two', 500, 300, true);

Is this function depreciated? Or am I missing something?

Upvotes: 0

Views: 356

Answers (1)

mrogers
mrogers

Reputation: 11

Did you add the add_image_size() to your functions.php file, if so your code should function properly?

There might be more guidance in this similar question.

Upvotes: 1

Related Questions