<?php

$currentPageID = CONST_ABOUT_PAGE_ID;

$profileAboutFactHeading = get_field('profile_about_fact_heading',$currentPageID);

$profileAboutFactIcon = array();
$profileAboutFactTitle = array();
$profileAboutFactValue = array();

if(have_rows('profile_about_facts',$currentPageID)){
    while(have_rows('profile_about_facts',$currentPageID)){
        the_row();      

        $profileAboutFactIcon[] = get_sub_field('profile_about_fact_icon',$currentPageID);
        $profileAboutFactTitle[] = get_sub_field('profile_about_fact_title',$currentPageID);
        $profileAboutFactValue[] = get_sub_field('profile_about_fact_value',$currentPageID);

    }
}

?>

<?php
    if(sizeof($profileAboutFactIcon) > 0 ){
?>
    <div class="white-space-50"></div>


    <!-- Fun Facts -->
    <div class="row">
        <div class="col-xs-12 col-sm-12">
            <div class="block-title">
                <?php 
                    $tempArray = explode(",",$profileAboutFactHeading);
                    if(sizeof($tempArray) > 1 ){
                ?>
                        <h3><?php echo($tempArray[0]); ?> <span><?php echo($tempArray[1]); ?></span></h3>
                <?php
                    }
                    else{
                ?>
                        <h3><?php echo($tempArray[0]); ?></h3>
                <?php
                    }
                ?>
            </div>
        </div>
    </div>

    <div class="row">
        <?php                    
            for($counter=0; $counter < sizeof($profileAboutFactIcon); $counter++ ){
        ?>
            <div class="col-xs-12 col-sm-4">
                <div class="fun-fact gray-default">
                    <i class="lnr <?php echo($profileAboutFactIcon[$counter]); ?>"></i>
                    <h4><?php echo($profileAboutFactTitle[$counter]); ?></h4>
                    <span class="fun-fact-block-value"><?php echo($profileAboutFactValue[$counter]); ?></span>
                    <span class="fun-fact-block-text"></span>
                </div>
            </div>
        <?php
            }
        ?>

    </div>
    <!-- End of Fun Facts -->

<?php
    }
?>