Site logo

Archived topic

Create Custom Image Sizes

19 replies · Started by Roger on August 7, 2017

Viewing posts 16–20 of 20

You're welcome :)

Hi Tom,

I want to add a third custom size image (1024x1000), so I tried:

add_action( 'after_setup_theme', function() {
add_image_size( 'horiz-med', 800, 526, true );
add_image_size( 'vert-med', 800, 1050, true );
add_image_size( ‘horiz-1024’, 1024, 1000 true );
} );

I received the message:
Your PHP code changes were rolled back due to an error on line 19 of file wp-content/themes/generatepress_child/functions.php. Please fix and try saving again.

I don't know what to fix as I don't know what's causing the error. I had this problem a few weeks ago when I wanted to add the vert-med 800, 1050 image. At that time you had me add the code:
add_action( 'after_setup_theme', function() {
add_image_size( 'horiz-med', 800, 526, true );
add_image_size( 'vert-med', 800, 1050, true );
} );

That worked and allowed for the second custom image size (800, 1050). I tried doing the same thing for the third custom size (1024, 1000 as noted in the add_action string at the beginning of this email.) All I got was the error message noted above

Any suggestions would be great.

Thanks.

Hey Shawn,

You're missing a comma between 1000 and true

Let me know :)

That does make a difference, thanks Tom.

No problem :)

This archived topic is closed to new replies.