<?php
/**
 * Buzz_Agency Process Section Functions And Definations
 *
 * @package Buzz_Agency
 */
function buzz_agency_process_callback(){
	$process_option = get_theme_mod('buzz_agency_homepage_setting_process_option',0);
	$process_text_readmore = esc_html(get_theme_mod( 'buzz_agency_process_readmore',esc_html__('Discover More','buzz-agency') ) );
	$process_text_one = esc_html(get_theme_mod( 'buzz_agency_process_text_one',esc_html__('Research','buzz-agency') ) );
	$process_text_two = esc_html(get_theme_mod( 'buzz_agency_process_text_two',esc_html__('Planning','buzz-agency') ) );
	$process_text_three = esc_html(get_theme_mod( 'buzz_agency_process_text_three',esc_html__('Apply','buzz-agency') ) );
	$image = get_theme_mod('buzz_agency_process_image','');
	$bg_image = get_theme_mod('buzz_agency_process_section_bg_image','');
	if($process_option == '1'): 
?>
	<section class="process-section">
	    <div class="container">
	        <div class="process-content-wrapper">

	        	<?php $process_page  = get_theme_mod('buzz_agency_process_page'); ?>

	        		<?php   if( !empty( $process_page ) ): 

	        			$args = array (                                 
	        			'page_id'           => absint( $process_page ),
	        			'post_status'       => 'publish',
	        			'post_type'         => 'page',
	        			);

	        			$loop_about = new WP_Query($args);

	        			if ( $loop_about->have_posts() ) : ?>

				            <div class="process-content os-animation" data-os-animation="slideInLeft">

				            	<?php while ($loop_about->have_posts()) : $loop_about->the_post();?>

				                <h2 class="entry-title"><?php the_title(); ?></h2>
				                <div class="entry-content">
				                    <p><?php echo esc_html(wp_trim_words(get_the_content(),35,'...')); ?></p>
				                    <ul>
				                    	<?php if(!empty($process_text_one)){ ?>
				                        	<li><span></span> <?php echo esc_html($process_text_one);?></li>
				                    	<?php }?>
				                    	<?php if(!empty($process_text_two)){ ?>
				                        	<li><span></span> <?php echo esc_html($process_text_two);?></li>
			                          	<?php }?>
			                          	<?php if(!empty($process_text_three)){ ?>
				                        	<li><span></span> <?php echo esc_html($process_text_three);?></li>
				                        <?php }?>
				                    </ul>
				                    <?php if(!empty($process_text_readmore)){ ?>
				                   		 <a href="<?php the_permalink();?>" class="box-button"><?php echo esc_html($process_text_readmore);?><span></span></a>
				                    <?php }?>
				                </div>

		                		<?php endwhile; 
		                 		   wp_reset_postdata();?> 
				            </div>

				    <?php endif;
				    endif;
				    ?>  
				<?php if( !empty( $image) ) { ?>           
		            <figure class="featured-image os-animation" data-os-animation="slideInRight"
		                data-os-animation-delay="0.8s">
		               <img src="<?php echo esc_url($image);?>" />
		            </figure>
	            <?php } ?>
	            <?php if( !empty( $bg_image) ) { ?>        
		            <figure class="process-bg-image os-animation" data-os-animation="slideInRight"
		                data-os-animation-delay="0.3s">
		                <img src="<?php echo esc_url($bg_image);?>" />
		            </figure>
	             <?php } ?>
	        </div>
	    </div>
	</section>
<?php endif;   ?>	
<?php
}
add_action('buzz_agency_process_callback_action','buzz_agency_process_callback');		