Created
January 9, 2017 07:07
-
-
Save antiden/a321f34efb666e8c9b4c9ddea154e365 to your computer and use it in GitHub Desktop.
WP ACF Image Object
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('thumbnail'); ?> | |
<?php if( !empty($image) ) { ?> | |
<div class="article_thumb"> | |
<?php | |
$url = $image['url']; | |
$title = $image['title']; | |
$size = 'news'; | |
$thumb = $image['sizes'][ $size ]; | |
?> | |
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php echo $thumb; ?>" alt="<?php the_title(); ?>"></a> | |
</div> | |
<?php } else if (empty($image)) { ?> | |
<div class="article_thumb"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php echo get_bloginfo('template_directory') . '/images/noimage.jpg'; ?>" alt="<?php the_title(); ?>"></a></div> | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment