[Support request] Problem setting custom image sizes

Home Forums Support [Support request] Problem setting custom image sizes

Home Forums Support Problem setting custom image sizes

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #859895
    Shawn

    Hi,

    Late last month, I had problems creating custom image sizes.

    I want to add a third custom size image (1024×1000), 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 I was advised to 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.

    GeneratePress 2.2.2
    GP Premium 1.7.8
    #859953
    David
    Staff
    Customer Support

    Hi there,

    could be because of the missing , (comma) before the True value:

    add_image_size( ‘horiz-1024’, 1024, 1000 true );

    Can you double check?

    #860399
    Shawn

    That’s it, thanks David.

    #860596
    David
    Staff
    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.