Created
December 1, 2015 11:05
-
-
Save tjhole/2549a5c9c22953dcb2ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$image = get_field('image'); | |
if( !empty($image) ): | |
// vars | |
$url = $image['url']; | |
$title = $image['title']; | |
$alt = $image['alt']; | |
$caption = $image['caption']; | |
// thumbnail | |
$size = 'thumbnail'; | |
$thumb = $image['sizes'][ $size ]; | |
$width = $image['sizes'][ $size . '-width' ]; | |
$height = $image['sizes'][ $size . '-height' ]; | |
if( $caption ): ?> | |
<div class="wp-caption"> | |
<?php endif; ?> | |
<a href="<?php echo $url; ?>" title="<?php echo $title; ?>"> | |
<img src="<?php echo $thumb; ?>" alt="<?php echo $alt; ?>" width="<?php echo $width; ?>" height="<?php echo $height; ?>" /> | |
</a> | |
<?php if( $caption ): ?> | |
<p class="wp-caption-text"><?php echo $caption; ?></p> | |
</div> | |
<?php endif; ?> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment