1

I use events manager pro plugin to show an eventslist. These event-list is showing their thumbnail image in the new (wordpress 4.4) wordpress image size "medium_large" (width 768px). I need an image size of 600x255px which is cropped from the center.

How can i update these image size in my functions.php?

1

You can call add_image_size() again to update the existing image size. Assuming it is called medium_large (Events Manager Pro is a paid plugin so not very much people have it) you can do something like:

<?php
function update_medium_large_size_wpse216595() {
    add_image_size( 'medium_large', 600, 255, array( 'center', 'top' ) );
}
add_action( 'init', 'update_medium_large_size_wpse216595', 11 );

Then you will need to regenerate the thumbnails. Although I am not 100% sure that init is the right hook for the job.

p.s. You can check this if you are using a child theme.

p.s. 2. I am not sure that I understand the center cropping correctly. You many need to play with it a bit. array( 'center', 'top' ) will crop the picture in the center ('trimming' the right and left part).

  • The inithook is not necessary, to early that cost of performance and time. You should use the hook after_setup_theme. This is the 'init' for run functions for the front end, the theme and should work. – bueltge Jan 2 '18 at 10:22
0

I tried to update the image size with:

add_image_size( 'medium_large', 600, 255, array( 'center', 'top' ) );

But when i update the image size with height, width and crop, wordpress is just using the "large" image-size. When i just use add_image_size with the width argument:

add_image_size('medium_large', 600, '', true);

The image size gets updatet to 600px. Any idea what the problem could be?

0

If you want to get image to specific size, first you must add image size

add_image_size( 'medium_large', 600, 255, array( 'center', 'top' ) );

You have already upload image before add image size code, You must be regenerate image. You can use Regenerate Thumbnails plugin.

0

According to what has been written in the documentation about responsive images in WP:

https://make.wordpress.org/core/2015/11/10/responsive-images-in-wordpress-4-4/

you should use update_option (doc here and here) to change size medium_large images

For example:

update_option('medium_large_size_w',444)

update_option('medium_large_size_h',444)

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.