Skip to content

Instantly share code, notes, and snippets.

@billerickson
Forked from Goodvalley-CameraSki/single-images.php
Last active November 2, 2016 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/c60acc13e15be95b9dcae7b837f64ef3 to your computer and use it in GitHub Desktop.
Save billerickson/c60acc13e15be95b9dcae7b837f64ef3 to your computer and use it in GitHub Desktop.
<?php
$images = get_post_meta( get_the_ID(), 'images', true );
if ( $images ) {
for( $i = 0; $i < $images; $i++ ) {
$image_name = get_post_meta( get_the_ID(), 'images_' . $i . '_image_name', true );
$image_path = get_post_meta( get_the_ID(), 'images_' . $i . '_image_path', true );
$class = 0 == $i || 0 == $i % 4 ? 'one-fourth first' : 'one-fourth';
echo '<div class="' . $class . '"><p class="images"><img src="' . esc_url( $DOCUMENT_ROOT . $image_path ) . '" alt="Image 1" width="100%" align="middle" class="some-class" /></p>' . esc_html( $image_name ) . '</div>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment