Answer the question
In order to leave comments, you need to log in
WordPress, ACF plugin, have a small question?
Hello, can you please advise. I'm using the "Repeater" from ACF, I draw a link to the project and pictures of this project. That is, I have a "preview" picture inside the link, by clicking on which the photo comes off in full scale on the whole screen.
The path for the full size image I pasted:
href="<?php echo $ale_projects_list_item['ale_projects_img'] ?>"But how to set the dimensions for the preview image? to use the same photo, but WordPress to crop it to the specified dimensions?
<?php
echo '<div class="project slideInLeft wow" data-wow-offset="200">';
$ale_projects_list = get_field('ale_projects_list');
foreach ( $ale_projects_list as $ale_projects_list_item ) {
?>
<a class="project__link" href="<?php $ale_projects_list_item['ale_projects_link'] ?>" target="_blank">
vavilon-dom.kz
</a>
<a class="project__img" href="<?php echo $ale_projects_list_item['ale_projects_img'] ?>" data-lightbox="project">
<img src="..............." alt="">
</a>
<?php
}
echo '</div>';
?>
Answer the question
In order to leave comments, you need to log in
Image field type select id
large - registered thumbnail size in wp, you can add your own via functions.php
$thumb_ID = get_sub_field('ale_projects_img');
$img_src = wp_get_attachment_image_src($thumb_ID, 'large');
<img src="<?php echo $img_src[0]; ?>">
First, create thumbnails with the size you need
https://wp-kama.ru/function/add_image_size
Install the regenerate thumbnails plugin and create thumbnails.
And then use them in ACF, as KingAnton pointed out
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question