-
-
Save billerickson/bc31346186d0b43b9f5090205cb1c29d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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