wordpress image text acf

Solutions on MaxInterview for wordpress image text acf by the best coders in the world

showing results for - "wordpress image text acf"
Daniele
25 May 2020
1<?php 
2$image = get_field('image');
3if( !empty( $image ) ): ?>
4    <img src="<?php echo esc_url($image['url']); ?>" alt="<?php echo esc_attr($image['alt']); ?>" />
5<?php endif; ?>
Luana
19 Jan 2021
1<?php
2$image = get_field('image');
3if( $image ):
4
5    // Image variables.
6    $url = $image['url'];
7    $title = $image['title'];
8    $alt = $image['alt'];
9    $caption = $image['caption'];
10
11    // Thumbnail size attributes.
12    $size = 'thumbnail';
13    $thumb = $image['sizes'][ $size ];
14    $width = $image['sizes'][ $size . '-width' ];
15    $height = $image['sizes'][ $size . '-height' ];
16
17    // Begin caption wrap.
18    if( $caption ): ?>
19        <div class="wp-caption">
20    <?php endif; ?>
21
22    <a href="<?php echo esc_url($url); ?>" title="<?php echo esc_attr($title); ?>">
23        <img src="<?php echo esc_url($thumb); ?>" alt="<?php echo esc_attr($alt); ?>" />
24    </a>
25
26    <?php 
27    // End caption wrap.
28    if( $caption ): ?>
29        <p class="wp-caption-text"><?php echo esc_html($caption); ?></p>
30        </div>
31    <?php endif; ?>
32<?php endif; ?>