Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created August 8, 2014 14:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/252b7cce9ba4d4b1bef9 to your computer and use it in GitHub Desktop.
Save billerickson/252b7cce9ba4d4b1bef9 to your computer and use it in GitHub Desktop.
<?php
// Repeater field called 'be_section' with 'title' and 'description' subfields
$sections = get_post_meta( get_the_ID(), 'be_section', true );
for( $i = 0; $i < $sections; $i++ ) {
$title = esc_html( get_post_meta( get_the_ID(), 'be_section_' . $i . '_title', true );
$description = get_post_meta( get_the_ID(), 'be_section_' . $i . '_description', true );
echo '<div class="section"><h2>' . $title . '</h2>' . wpautop( $description ) . '</div>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment