Created
February 29, 2016 19:16
-
-
Save FutureMedia/909bd5b917cfb370b20f 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 hidden or 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