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

    Hello,

    I added a custom image size in my child theme function.php file, and I see it in my media settings in wordpress, but I can’t use it as an image size in the slider accordeon shortcode… what did I do wrong?
    Thanks a lot

    #572613

    Hey maxgorelkine,

    What code did you use?

    Best regards,
    Rikard

    #573586

    // add new size
    add_image_size( ‘instinct_portraits’, 267, 400, false );

    // make the new size available in the media library (and image element etc.)
    add_filter( ‘image_size_names_choose’, ‘my_custom_sizes’ );

    function my_custom_sizes( $sizes ) {
    return array_merge( $sizes, array(
    ‘instinct_portraits’ => __( ‘Instinct Portrait’ ),
    ) );
    }

    #574335

    Hey!

    Please replace the code with this:

    // add new size
    add_image_size( 'awesome-size', 1500, 630, true );
    
    // make the new size available in the media library (and image element etc.)
    add_filter( 'image_size_names_choose', 'my_custom_sizes' );
    
    function my_custom_sizes( $sizes ) {
        return array_merge( $sizes, array(
            'awesome-size' => __( 'Awesome Size' ),
        ) );
    }

    Upload the images again or regenerate them with a plugin.

    Cheers!
    Ismael

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.