1

Hi I am trying to add new size under the large size in Media Settings, but that's not working, I have studied different articles but for sure I am missing something, please guide me on this.

This is what I am trying to achieve: http://prntscr.com/g2idly

    add_theme_support( 'post-thumbnails' );

    add_image_size( 'featured-large', 640, 294, true ); // width, height, crop
    add_image_size( 'featured-small', 320, 147, true );

    add_image_size( 'medium-width', 480 );
    add_image_size( 'medium-height', 9999, 480 );
    add_image_size( 'medium-something', 480, 480 );

    add_filter( 'image_size_names_choose', 'wpshout_custom_sizes' );

    function wpshout_custom_sizes( $sizes ) {
        return array_merge( $sizes, array(
            'medium-width' => __( 'Medium Width' ),
            'medium-height' => __( 'Medium Height' ),
            'medium-something' => __( 'Medium Something' ),
                ) );
    }

This is the code I am trying to put in and testing but nothing happening.

1

Change your function to this.

function wpshout_custom_sizes($sizes) {
  $sizes['medium-width'] = __( 'Medium Width' );
  $sizes['medium-height'] = __( 'Medium Height');
  $sizes['medium-something'] = __( 'Medium Something');
  return $sizes;
}
add_filter( 'image_size_names_choose', 'wpshout_custom_sizes' );
  • this is not working I have already tried – mohsin Jul 31 '17 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.