<?php
/**
 * The template for displaying content section
 *
 * @package Oginer
 */
 
$content_id = get_theme_mod( 'oginer_content_id', 'content' );
$content_page = get_theme_mod( 'oginer_content_page' );
$content_url = get_theme_mod( 'oginer_content_url', '#' );
$content_url_title = get_theme_mod( 'oginer_content_url_title', __( 'read more', 'oginer' ) );

if ( $content_page ) { ?>
	<section id="<?php echo esc_attr( $content_id ); ?>" class="mw-section">
		<div class="container">
			<div class="row">
				<?php
					$args = array(
						'page_id' => absint( $content_page ),
						'post_status' => 'publish'
					);

					$post_query = new WP_Query( $args );
					
					if( $post_query->have_posts() ): ?>
						<?php while ( $post_query->have_posts() ) : $post_query->the_post(); ?>
							<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 mw-animation" data-os-animation="fadeInRight">
								<?php if ( has_post_thumbnail() ) : ?>

									<div class="featured-media">
							
										<?php the_post_thumbnail( 'full' ); ?>
										
									</div><!-- .featured-media -->
									
								<?php endif; ?>
							</div>
							<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 mw-animation" data-os-animation="fadeInLeft">
								<div class="section-content text-right">
									<h2 class="section-title"><?php the_title(); ?></h2>
									
									<?php the_content(); ?>
									
									<?php if ( $content_url != '' ) { ?>
									<div class="button-box">
										<a href="<?php echo esc_url( $content_url ); ?>" class="btn"><?php echo esc_html( $content_url_title ); ?></a>
									</div>
									<?php } ?>
								</div>
							</div>
							<?php
						endwhile;
						wp_reset_postdata();
					endif;
				?>
			</div>
		</div>
	</section>
	<?php
}