Last active
April 16, 2019 23:21
-
-
Save billerickson/3510d2ce61495b18a5df to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
/** | |
* Your Child Theme | |
* | |
* Template Name: Landing | |
*/ | |
/** | |
* Flexible Content | |
* | |
*/ | |
function be_landing_page_content() { | |
$rows = get_post_meta( get_the_ID(), 'be_content', true ); | |
foreach( (array) $rows as $count => $row ) { | |
switch( $row ) { | |
// Full Width Content layout | |
case 'full_width_content': | |
$title = esc_html( get_post_meta( get_the_ID(), 'be_content_' . $count . '_title', true ) ); | |
$content = get_post_meta( get_the_ID(), 'be_content_' . $count . '_content', true ); | |
echo '<div class="flex-content full-width-content"><div class="wrap">'; | |
if( $title ) | |
echo '<h2>' . $title . '</h2>'; | |
if( $content ) | |
echo '<div class="section-content">' . apply_filters( 'the_content', $content ) . '</div>'; | |
echo '</div></div>'; | |
break; | |
// Content with Image layout | |
case 'content_with_image': | |
$title = esc_html( get_post_meta( get_the_ID(), 'be_content_' . $count . '_title', true ) ); | |
$content = get_post_meta( get_the_ID(), 'be_content_' . $count . '_content', true ); | |
$image = get_post_meta( get_the_ID(), 'be_content_' . $count . '_image', true ); | |
echo '<div class="flex-content content-with-image"><div class="wrap">'; | |
if( $title ) | |
echo '<h2>' . $title . '</h2>'; | |
if( $image ) | |
echo '<div class="section-image">' . wp_get_attachment_image( $image, 'medium' ) . '</div>'; | |
if( $content ) | |
echo '<div class="section-content">' . apply_filters( 'the_content', $content ) . '</div>'; | |
echo '</div></div>'; | |
break; | |
} | |
} | |
} | |
add_action( 'be_content_area', 'be_landing_page_content' ); | |
// Remove 'site-inner' from structural wrap | |
add_theme_support( 'genesis-structural-wraps', array( 'header', 'footer-widgets', 'footer' ) ); | |
// Build the page | |
get_header(); | |
do_action( 'be_content_area' ); | |
get_footer(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment