Skip to content

Instantly share code, notes, and snippets.

@carrieforde
Created March 17, 2016 00:18
Show Gist options
  • Save carrieforde/8ced7b37b5c62f4bac1a to your computer and use it in GitHub Desktop.
Save carrieforde/8ced7b37b5c62f4bac1a to your computer and use it in GitHub Desktop.
<div class="carrieforde-project-images">
<?php
if ( $project_images ) {
for ( $i = 0; $i < $project_images; $i++ ){
$project_image = get_post_meta( get_the_id(), 'project_images_' . $i . '_project_image', true );
$img = get_post( $project_image );
$caption = $img->post_excerpt;
$imgcaption = $caption;
if ( ! empty( $caption ) ) {
$imgcaption = '<figcaption class="wp-caption-text">' . wp_kses_post( $caption ) . '</figcaption>';
}
echo '<div class="carrieforde-project-image-wrapper"><a href="' . wp_get_attachment_url( $project_image ) . '" class="fancybox" rel="project">' . wp_get_attachment_image( $project_image, $image_size ) . '</a>' . $imgcaption . '</div>';
}
}
?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment