<?php
/**
 * Custom Reservation Funtions
 *
 * @package Matrimony
 */
$matrimony_reservation_page  = get_theme_mod('matrimony_reservation_page',0); 
$matrimony_reservation = get_theme_mod( 'matrimony_reservation', 0 );
$image_one = get_theme_mod('matrimony_reservation_image_one','');
$image_two = get_theme_mod('matrimony_reservation_image_two','');
$matrimonial_reservation_option = get_theme_mod('matrimonial_reservation_option', 0 );
if( 0 == $matrimonial_reservation_option){
	return;
}?>
<section class="rvsp-section default-padding">
    <div class="container">
        <div class="rvsp-wrap">
        	<?php   if( !empty( $matrimony_reservation_page ) ): 
        		$args = array (                                 
        		'page_id'           => absint( $matrimony_reservation_page ),
        		'post_status'       => 'publish',
        		'post_type'         => 'page',
        			);
        		$loop_reservation = new WP_Query($args);
        		if ( $loop_reservation->have_posts() ) : ?>
		            <div class="section-intro">
		            	<?php while ($loop_reservation->have_posts()) : $loop_reservation->the_post();?>
			                <header class="entry-header heading animated wow fadeInDown" data-wow-duration="1s">
			                    <h4 class="entry-title"><?php the_title(); ?></h4>
			                </header>
			                <div class="header-img-wrap animated wow fadeInUp" data-wow-duration="1s">
			                    <?php the_post_thumbnail(); ?>
			                </div>
	                        <?php 
	                        $reservation_des_option = get_theme_mod('matrimonial_revervation_dec_option', 0 );
	                        if( $reservation_des_option == '1' ):
                        	?>
								<div class="section-description animated wow fadeInUp" data-wow-duration="1s">
									<p> <?php echo esc_html(wp_trim_words(get_the_content(),30,'&hellip;')); ?></p>
								</div>
		                    <?php endif; ?>
                		<?php endwhile;  ?> 
		            </div>
		        <?php endif;
		        wp_reset_postdata();
	        endif;  ?>    
        	<?php  if( !empty( $matrimony_reservation ) ): 
        		$args = array (                                 
	        		'page_id'           => absint( $matrimony_reservation ),
	        		'post_status'       => 'publish',
	        		'post_type'         => 'page',
        		);
        		$loop_reservation = new WP_Query($args);
        		if ( $loop_reservation->have_posts() ) : ?>
		            <div class="reservation-form animated wow fadeInUp" data-wow-duration="1s">
		            	<?php while ($loop_reservation->have_posts()) : $loop_reservation->the_post();?>
			                <header class="entry-header heading animated wow fadeInDown" data-wow-duration="1s">
			                    <h4 class="entry-title"><?php the_title(); ?></h4>
			                </header>
		 	                <div class="entry-contain">
		 	                    <p><?php the_content(); ?></p>
		 	                </div>					                
						<?php endwhile; ?>
		            </div>
	            <?php endif; 
	            wp_reset_postdata();
            endif; ?>
        </div>
    </div>
    <?php if( !empty( $image_one) ) { ?> 
	    <div class="top-left-img">
	        <img src="<?php echo esc_url($image_one);?>" />
	    </div>
	 <?php } ?>  
	<?php if( !empty( $image_two) ) { ?>  
	    <div class="bottom-right-img">
	         <img src="<?php echo esc_url($image_two);?>" />
	    </div>
	<?php } ?>     
</section><!-- grvsp-section end -->
