Reputation:
I want the size to add more image sizes in WordPress media. I want to insert images in the page of specific size.
I am also adding image size, but it didn't work.
add_image_size('cpm_gallery', 450, 400 ,true);
How can I do this?
See attached:
Upvotes: 0
Views: 382
Reputation: 927
Open your themes' functions.php and check your using the 'add_theme_support('post-thumbnails') before your add_image_size code,
See example:
add_theme_support('post-thumbnails');
set_post_thumbnail_size(700, 400, true);
add_image_size( 'portfolio-thumb', 360, 225, true);
add_image_size( 'latest-post', 400, 200, true);
This is the code I use on websites so it should work. If not there is another issue.
Also if you are wanting to resize media you have already uploaded you will need to regenerate thumbnails, see this plugin: https://wordpress.org/plugins/regenerate-thumbnails/
Upvotes: 1
Reputation: 490
add_filter( 'image_size_names_choose', 'my_custom_sizes' );
function my_custom_sizes( $sizes ) {
return array_merge( $sizes, array(
'your-custom-size' => __( 'Your Custom Size Name' ),
) );
}
Try the code above, should give you the results that you want.
Upvotes: 1