Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active December 9, 2016 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save billerickson/5d4cf5d5c45018efc38b91ab8b6251cd to your computer and use it in GitHub Desktop.
Save billerickson/5d4cf5d5c45018efc38b91ab8b6251cd to your computer and use it in GitHub Desktop.
<?php
$items = get_post_meta( get_the_ID(), 'ea_items', true );
if( ! $items )
return;
echo '<div class="row">';
for( $i = 0; $i < $items; $i++ ) {
// Display item content
echo '<div class="item">' . get_post_meta( get_the_ID(), 'ea_items_' . $i . '_stuff', true ) . '</div>';
// Every fourth one, break to new row
if( $i !== 0 && 0 == $i % 4 ) {
echo '</div><div class="row">';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment