Answer the question
In order to leave comments, you need to log in
How to correctly specify image size in ACF?
How can I set my image size in this ACF plugin code (different from the thumbnails that are set in woocommerce? For example: I need this image to be displayed 250*270.
<?php
$image = get_field('image-descr');
$size = 'thumbnail';
if( $image ) {
echo wp_get_attachment_image( $image, $size );
}
?>
Answer the question
In order to leave comments, you need to log in
Option 1.
On a good start, you need to create a new size.
Then use this size at the time of output.
add_image_size( 'new-size', 250, 270, true );
$image = get_field('image-descr');
$size = 'new-size';
if( $image ) {
echo wp_get_attachment_image( $image, $size );
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question