Skip to content

Instantly share code, notes, and snippets.

@Goodvalley-CameraSki
Last active October 26, 2018 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save Goodvalley-CameraSki/aaff9768b21381c37d1dd67f29ba316d to your computer and use it in GitHub Desktop.
Save Goodvalley-CameraSki/aaff9768b21381c37d1dd67f29ba316d 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="' . $DOCUMENT_ROOT . $image_path . '" alt="Image 1" width="100%" align="middle" class="some-class" /></p>' . $image_name . '</div>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment