<?php
/**
 * Template part for displaying home gallery section
 *
 * @package Education_Soul
 */

$gallery_title = education_soul_get_option( 'gallery_title' );
$gallery_page  = education_soul_get_option( 'gallery_page' );
?>

<div id="education-soul-gallery" class="home-section home-section-gallery">
	<div class="container">
		<?php if ( ! empty( $gallery_title ) ) : ?>
			<h2 class="section-title"><?php echo esc_html( $gallery_title ); ?></h2>
		<?php endif; ?>

		<?php if ( absint( $gallery_page ) > 0 ) : ?>
			<?php
			$qargs = array(
				'posts_per_page' => 1,
				'post_type'      => 'page',
				'p'              => $gallery_page,
			);

			$the_query = new WP_Query( $qargs );
			?>

			<?php if ( $the_query->have_posts() ) : ?>
				<?php
				while ( $the_query->have_posts() ) :
					$the_query->the_post();
					?>
					<?php the_content(); ?>
				<?php endwhile; ?>
				<?php wp_reset_postdata(); ?>
			<?php endif; ?>
		<?php endif; ?>
	</div><!-- .container -->
</div><!-- .home-section-gallery -->
