[Resolved] Create Custom Image Sizes

Home Forums Support [Resolved] Create Custom Image Sizes

Home Forums Support Create Custom Image Sizes

  • This topic has 19 replies, 5 voices, and was last updated 5 years ago by Tom.
Viewing 5 posts - 16 through 20 (of 20 total)
  • Author
    Posts
  • #846990
    Tom
    Lead Developer
    Lead Developer

    You’re welcome πŸ™‚

    #859747
    Shawn

    Hi Tom,

    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 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.

    #859998
    Tom
    Lead Developer
    Lead Developer

    Hey Shawn,

    You’re missing a comma between 1000 and true

    Let me know πŸ™‚

    #860397
    Shawn

    That does make a difference, thanks Tom.

    #860699
    Tom
    Lead Developer
    Lead Developer

    No problem πŸ™‚

Viewing 5 posts - 16 through 20 (of 20 total)
  • You must be logged in to reply to this topic.