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