Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created September 12, 2017 12:58
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/bc31346186d0b43b9f5090205cb1c29d to your computer and use it in GitHub Desktop.
Save billerickson/bc31346186d0b43b9f5090205cb1c29d to your computer and use it in GitHub Desktop.
<?php
/* Template Name: Modules */
/**
* Modular Content
*
*/
function be_modular_content() {
echo '<article>';
// First section is standard content
echo '<div class="section"><div class="wrap">';
genesis_do_breadcrumbs();
genesis_entry_header_markup_open();
genesis_do_post_title();
genesis_entry_header_markup_close();
genesis_do_post_content();
echo '</div></div>';
// Use ACF field to output additional sections
$sections = get_post_meta( get_the_ID(), 'be_section', true );
for( $i = 0; $i < $sections; $i++ ) {
echo '<div class="section"><div class="wrap">';
echo apply_filters( 'the_content', get_post_meta( get_the_ID(), 'be_section_' . $i . '_content', true ) );
echo '</div></div>';
}
echo '</article>';
}
// Build the page
get_header();
be_modular_content();
get_footer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment