<?php
/**
 * Buzz_Agency_Pro About Us Section Functions And Definations
 *
 * @package Buzz_Agency
 */
function buzz_agency_about_callback(){
	$about_home_option = get_theme_mod('buzz_agency_homepage_setting_about_option', 0 );
	$about_readmore = get_theme_mod( 'buzz_agency_about_readmore',esc_html__('Discover More','buzz-agency') );	
	if( $about_home_option == '1' ): ?>
		<section class="about-us-section">
			<div class="container">
				<div class="about-us-content-wrapper">
					<?php $about_page  = get_theme_mod('buzz_agency_about_page'); ?>				
					<?php   if( !empty( $about_page ) ): 
						$args = array (                                 
						'page_id'           => absint( $about_page ),
						'post_status'       => 'publish',
						'post_type'         => 'page',
						);
						$loop_about = new WP_Query($args);
						if ( $loop_about->have_posts() ) : ?>
				            <div class="experience-years os-animation" data-os-animation="slideInLeft">
				            	<?php while ($loop_about->have_posts()) : $loop_about->the_post();?>
					                <h2><?php the_title(); ?></h2>
					                <span>
					                	<?php echo esc_html(wp_trim_words( get_the_content(),60,'...')); ?>
				                	</span>
					                <figure class="about-bg os-animation" data-os-animation="slideInLeft"
					                    data-os-animation-delay="0.5s">
										<?php the_post_thumbnail(); ?>
					                </figure>
				         		<?php endwhile; 
			          		   wp_reset_postdata();?>         
				            </div>
				        <?php endif;
			       	endif; ?> 

				    <?php $about_page_two  = get_theme_mod('buzz_agency_about_page_two'); ?>				
					<?php if( !empty( $about_page_two ) ): 
						$args = array (                                 
						'page_id'           => absint( $about_page_two ),
						'post_status'       => 'publish',
						'post_type'         => 'page',
						);
						$loop_about_two = new WP_Query($args);
						if ( $loop_about_two->have_posts() ) : ?>
				            <div class="about-us-content os-animation" data-os-animation="slideInRight"
				                data-os-animation-delay="0.9s">
				                <?php while ($loop_about_two->have_posts()) : $loop_about_two->the_post(); ?>
					                <h3><?php the_title(); ?></h3>
					                <p><?php echo esc_html(wp_trim_words(get_the_content(),60,'...')); ?></p>
					                <?php if( !empty( $about_readmore ) ) {	?>
					                	<a href="<?php the_permalink();?>" class="box-button"><?php echo esc_html($about_readmore);?><span></span></a>
					                	<?php
					                } ?>			                
			        			<?php endwhile; 
			         		   	wp_reset_postdata();?>
				            </div>
				        <?php endif;
			        endif; ?>   
				</div>
			</div>
		</section>
	<?php endif;   
}
add_action('buzz_agency_about_callback_action','buzz_agency_about_callback');		