, If/Else, . , (carousel_logo) ACF.
:

.. ACF Image Image Array, .
, the_field('carousel_logo'); . , ?
, URL- :
<?
$title = get_field('carousel_title_text');
$logo = get_field('carousel_logo');
if (!empty($title)) : ?>
<h2 class="promo"><?= $title ?></h2>
<?php elseif (!empty($logo)) : ?>
<img class="logo" src="<?= $logo ?>">
<?php else: ?>
<?php endif ?>
, :
<img class="logo" src="<?= $logo ?>">
:
<img class="logo" src="<?php echo $logo ?>">
, .
Bonus: If you work with different sizes of thumbnails, I would recommend using Image Array as the return value. In this case, it $logowill be an array containing all the information (for example, sizes, all sketches, titles, etc.).
Using:
<img class="logo" src="<?= $logo['sizes']['medium'] ?>">
where 'medium'is your sketch size to display it.
Also, please check the white papers for the ACF Image field type for more examples and further explanations.
source
share