I know this is much common and I did not find the right answer. So to show all possible image sizes I have done:
add_filter( 'image_size_names_choose', 'fashmag_image_sizes_choose' );
function fashmag_image_sizes_choose( $sizes ) {
$image_sizes = get_intermediate_image_sizes();
return $image_sizes;
}
This perfectly shows all image sizes but this puts the option value not name. So the generated HTML output
<select class="size" name="size" data-setting="size">
<option value="0">thumbnail</option>
<option value="1">medium</option>
<option value="2">medium_large</option>
</select>
In my gallery shortcode instead of putting thumbnail
it puts 0
[gallery link="file" size="0" ids="124,125,108,103"]
How can I correct this i.e. put thumbnail
instead of 0
?