<?php
/**
 * The template for displaying contact section
 *
 * @package Oginer
 */

$contact_id = get_theme_mod( 'oginer_contact_id', 'contact' );
$contact_page = get_theme_mod( 'oginer_contact_page' );
$contact_adress = get_theme_mod( 'oginer_contact_adress', __( 'Long Street 789, London, England', 'oginer' ) );
$contact_phone = get_theme_mod( 'oginer_contact_phone', __( '0039 444 17 29 743', 'oginer' ) );
$contact_email = get_theme_mod( 'oginer_contact_email', __( 'contact@yourdomain.com', 'oginer' ) );
$contact_more_icon = get_theme_mod( 'oginer_contact_more_icon', 'fa-clock-o' );
$contact_more_text = get_theme_mod( 'oginer_contact_more_text', __( 'Mon - Sat: 9:00 - 18:00', 'oginer' ) );
$contact_cf7 = get_theme_mod( 'oginer_contact_cf7' );
$class_no_cf7 = 'col-md-offset-3';
?>

<section id="<?php echo esc_attr( $contact_id ); ?>" class="mw-section contact-us">
	<div class="container">
		<?php if ( $contact_page ) { ?>
			<div class="row">
				<div class="section-title-box col-md-10 col-md-offset-1 text-center">
					<?php
						$args = array(
							'page_id' => absint( $contact_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(); ?>
							
								<h2 class="section-title"><?php the_title(); ?></h2>
								
								<p><?php the_content(); ?></p>
								
								<?php  
							endwhile;
							
							wp_reset_postdata();
							
						endif; 
					?>
				</div>
			</div>
			<?php
		}
		?>
		
		<div class="row">
			<?php if ( function_exists( 'wpcf7' ) && '' != $contact_cf7 ) { 
				$class_no_cf7 = '';
				?>
				<div class="col-md-6 mw-animation" data-os-animation="rubberBand">
					<?php 
					if ( $contact_cf7 ) {
						echo do_shortcode( $contact_cf7 );
					}
					?>
				</div>
				<?php 
			}
			?>
			
			<div class="<?php echo esc_attr( $class_no_cf7 ); ?> col-md-6 mw-animation" data-os-animation="rubberBand">
				<div class="row contact-box">
					<?php if ( $contact_adress != '' ) { ?>
					<div class="col-sm-6 address-box">
						<div class="address-box-icon">
							<i class="fa fa-map-marker"></i>
						</div>
						<p><?php echo esc_html( $contact_adress ); ?></p>
					</div>
					<?php } ?>
					<?php if ( $contact_phone != '' ) { ?>
					<div class="col-sm-6 address-box">
						<div class="address-box-icon">
							<i class="fa fa-phone"></i>
						</div>
						<p><?php __( 'Phone:', 'oginer' ); ?> <?php echo esc_html( $contact_phone ); ?></p>
					</div>
					<?php } ?>
					<?php if ( $contact_email != '' ) { ?>
					<div class="col-sm-6 address-box">
						<div class="address-box-icon">
							<i class="fa fa-envelope-o"></i>
						</div>
						<p><?php __( 'Email:', 'oginer' ); ?> <?php echo esc_html( $contact_email ); ?></p>
					</div>
					<?php } ?>
					<?php if ( $contact_more_text != '' ) { ?>
					<div class="col-sm-6 address-box">
						<div class="address-box-icon">
							<i class="fa <?php echo esc_attr( $contact_more_icon ); ?>"></i>
						</div>
						<p><?php echo esc_html( $contact_more_text ); ?></p>
					</div>
					<?php } ?>
				</div>
				
				<?php get_template_part( 'inc/social-icons' ); ?>

			</div>					
		</div>
	</div>
</section>