Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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
You can’t perform that action at this time.