<?php
/**
 * The template for displaying featured content
 *
 * @package Personal_Trainer
 */
?>

<?php
$enable = get_theme_mod( 'personaltrainer_reservation_option', 'disabled' );

if ( ! personaltrainer_check_section( $enable ) ) {
	// Bail if featured content is disabled.
	return;
}

$title       = get_theme_mod( 'personaltrainer_reservation_title', esc_html__( 'Reservation', 'personal-trainer' ) );
$description = get_theme_mod( 'personaltrainer_reservation_description', wp_kses_data( __( 'Begin today with <span class="bold">2 weeks</span> of <span class="italic">unlimited yoga</span> and <span class="italic">movement</span> classes for <span class="bold">$25</span>', 'personal-trainer' ) ) );
?>

<div class="reserve-content-wrapper section">
	<div class="wrapper">
		<?php if ( $title || $description ) : ?>
			<div class="section-heading-wrapper featured-section-headline">
				<?php if (  $title ) : ?>
					<div class="section-heading-wrap">
						<h2 class="section-title"><?php echo wp_kses_data( $title ); ?></h2>
					</div><!-- .heading-wrap -->
				<?php endif; ?>

				<?php if ( $description ) : ?>
					<div class="section-description"><?php echo wp_kses_post( $description ); ?></div>
				<?php endif; ?>
			</div><!-- .section-heading-wrapper -->
		<?php endif; ?>

		<div class="section-content-wrap">
			<article class="post hentry">
				<div class="entry-container">
					<?php
					$inner_title   = '';
					$inner_content = '';

					if ( 'publish' === get_post_status( get_theme_mod( 'personaltrainer_reservation_page' ) ) ) {
						$post_object = get_post( get_theme_mod( 'personaltrainer_reservation_page' ) );

						$inner_title   = $post_object->post_title;
						$inner_content = apply_filters( 'the_content', $post_object->post_content );
					}
					?>

					<div class="entry-content">
						<p><?php  echo esc_html( $inner_title ); ?></p>

						<?php echo $inner_content; // Uses Post Content that does not need escaping. ?>
					</div><!-- .entry-content -->
				</div><!-- .entry-container -->
			</article> <!-- article -->
		</div><!-- .section-content-wrap -->
	</div><!-- .wrapper -->
</div> <!-- reserve-content-wrapper -->
