<?php
/**
 * Buzz_Agency Counter Section Functions And Definations
 *
 * @package Buzz_Agency
 */
function buzz_agency_counter_callback(){ 
	$feature_option = get_theme_mod('buzz_agency_homepage_setting_counter_option',0);
	if($feature_option == '1'): 
?>
	<section class="counter-section">
	    <div class="container">
	        <div class="counter-item-wrapper">
	        	<?php 
	        	$counter_secton = get_theme_mod('theme_options_counter_secton');
	        	$counter_secton = json_decode( $counter_secton );
	        	if ( $counter_secton ): ?>
	        			<?php foreach ($counter_secton as  $counter) { 
	        		        $counter_number = $counter->counter_number;
	        		        $counter_title  = $counter->counter_title;
	        		        $counter_symbol = $counter->counter_icon; ?>

				            <div class="counter-item os-animation" data-os-animation="fadeInUp">

									<?php
			            	        if ( !empty( $counter_number ) || !empty( $counter_title ) || !empty( $counter_symbol ) ) { ?>        		<?php if ( '0' !== $counter_number && !empty( $counter_number ) ): ?>
			            	        	
							                <div class="count-info"> 
							                	<span class="start-count"><?php echo absint( $counter_number )?></span>
							                	<?php if ( !empty( $counter_symbol ) ): ?>
							                		<span class="counter-icon"><i class="<?php echo esc_attr( $counter_symbol );?>"></i></span>
							                	<?php endif; ?>
							                </div>

						                <?php endif; ?>

					                	<span class="counter-name"><?php echo esc_html( $counter_title )?></span>

			            		<?php }  ?>
		 
				            </div>
		           <?php  } ?>
				 
				 <?php endif; ?>  

	        </div>
	    </div>
	</section>
	<?php endif;   ?>
<?php
}
add_action('buzz_agency_counter_callback_action','buzz_agency_counter_callback');		