Skip to content

Instantly share code, notes, and snippets.

Created September 3, 2017 06:39
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 anonymous/7681e58c8ecea014edd47bde30fca4aa to your computer and use it in GitHub Desktop.
Save anonymous/7681e58c8ecea014edd47bde30fca4aa to your computer and use it in GitHub Desktop.
function yummy_get_about_section_details( $input ) {
$options = yummy_get_theme_options();
// about type
$about_content_type = $options['about_content_type'];
$content = array();
switch ( $about_content_type ) {
case 'page':
$post_id = null;
if ( isset( $options[ 'about_page' ] ) ) {
$post_id = $options[ 'about_page' ];
}
if ( ! empty( $post_id ) ) {
$content['title'] = get_the_title( $post_id );
$content['excerpt'] = get_post_field('post_content', $post_id);
}
break;
}
if ( ! empty( $content ) ) {
$input = $content;
}
return $input;
}
function yummy_render_about_section( $content_details = array() ) {
$options = yummy_get_theme_options();
if ( empty( $content_details ) ) {
return;
}
if( ( $options['about_content_type'] == 'page' ) && is_active_sidebar( 'about_section_widget_area' ) ) {
$addcolumn = 2;
}
else {
$addcolumn = 1;
}
?>
<section id="reservation-information" class="col-<?php echo $addcolumn; ?>">
<div class="wrapper">
<?php if( is_active_sidebar( 'about_section_widget_area' ) ) { ?>
<div class="column-wrapper">
<?php dynamic_sidebar( 'about_section_widget_area' ); ?>
</div><!--.column-wrapper-->
<?php } ?>
<div class="column-wrapper">
<div class="page-section">
<header class="entry-header">
<h2 class="entry-title"><?php echo esc_html( $content_details['title'] ); ?></h2>
</header><!--.entry-header-->
<?php if( ! empty( $content_details['excerpt'] ) ) { ?>
<div class="entry-content">
<p><?php echo wp_kses_post( $content_details['excerpt'] ); ?></p>
</div><!--.entry-content-->
<?php } ?>
</div><!-- .page-section -->
</div><!--.column-wrapper-->
</div><!--.wrapper-->
</section><!--#reservation-form-->
<?php }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment