Created
March 15, 2017 09:55
-
-
Save brettsmason/5029edefba41095dbee9acc72d674e57 to your computer and use it in GitHub Desktop.
Remove Front-End Dependency for ACF Gallery Field Example (displays images with src, alt, width/height and caption)
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
// Masonry Width Grids | |
$images = get_post_meta( get_the_ID(), 'masonry_image_grid', true ); | |
// Check if acf/custom field data exists | |
if( $images ) { ?> | |
<ul class="grid effect-4" id="grid"> | |
<?php foreach( $images as $image ) { ?> | |
<li> | |
<div class="masonry-block-wrap"> | |
<?php echo wp_get_attachment_image( $image, 'full' ); | |
if( !empty( get_post($image)->post_excerpt) ) { ?> | |
<div class="masonry-slide-overlay text-center"> | |
<p> | |
<?php echo get_post($image)->post_excerpt; ?> | |
</p> | |
</div> | |
<?php | |
} ?> | |
</div> | |
</li> | |
<?php | |
} ?> | |
</ul> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment