S
S
Sergey Konovalenko2018-02-20 14:01:49
CMS
Sergey Konovalenko, 2018-02-20 14:01:49

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>';
            ?>

5a8c00b4b10a4267815557.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
KingAnton, 2018-02-20
@sergeykonovalenko

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]; ?>">

O
Orkhan Hasanli, 2018-02-20
@azerphoenix

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 question

Ask a Question

731 491 924 answers to any question