Created
March 14, 2014 23:10
-
-
Save dompascal/9558961 to your computer and use it in GitHub Desktop.
WP - ACF conditional image
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 if(get_field('header_slideshow_image')) { ?> | |
<?php $image = wp_get_attachment_image_src(get_field('header_slideshow_image'), 'header-slideshow'); ?> | |
<img class="rsImg" src="<?php echo $image[0]; ?>" alt="" /> | |
<?php } elseif(get_field('blog_thumbnail')) { ?> | |
<?php $image = wp_get_attachment_image_src(get_field('blog_thumbnail'), 'header-slideshow'); ?> | |
<img class="rsImg" src="<?php echo $image[0]; ?>" alt="" /> | |
<?php } else { ?> | |
<img class="rsImg" src="<?php bloginfo('template_url'); ?>/css/img/slideshow-placeholder.jpg" alt="Image Unavailable" /> | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment