<?php
$no_elements = 1;
?>
<section id="pages" class="col-md-12">
    <div class="row">
        <?php
	    	for($i = 1; $i<=$no_elements; $i++) {
			 
			 		$page_title = get_theme_mod("homepage_pages_label".$i, 'Sample Heading');
					
					$page_desc = get_theme_mod("homepage_pages_desc".$i, 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.');
					
					$page_link = get_theme_mod("homepage_pages_link".$i, '#');
				
					$page_image = get_resized_only_image_from_url(get_theme_mod("homepage_pages_image".$i ,image('page-img.jpg')), 'pages');
					
					$section_class = ($i % 2 == 0) ? "section_wrap_second" : false;		
				 		
				    if($page_image) { ?>
                          <div class="section_wrap <?php echo $section_class; ?> os-animation" data-os-animation="fadeInUp" data-os-animation-delay="0.5s">
                               <?php if ($i % 2 != 0) { ?>
                                    <div class="image_section left-image col-md-6 col-sm-4" style="background-image:url(<?php echo $page_image; ?>)"></div> 
                                <?php } ?>
                                
                                <div class="section_padding col-md-6 col-sm-8 <?php if ($i % 2 != 0) { ?> col-md-offset-6 col-sm-offset-4 <?php } ?>">
                                    <h3 class="section_heading">
                                        <span><?php echo $page_title; ?></span>
                                    </h3>
                                    <?php
                                    if(!empty($page_desc)) {
                                    ?>
                                       <p><?php echo $page_desc; ?></p>
                                    <?php
                                    }
        
                                    if(!empty($page_link)) {
                                    ?>
                                      <a href="<?php echo $page_link; ?>" class="btn btn-primary"><?php _e('Read More', 'air-free'); ?></a>
                                    <?php
                                    }
                                    ?>
                                </div>
                                
                                <?php if($i % 2 == 0) { ?> 
                                    <div class="image_section right-image col-md-6 col-sm-4" style="background-image:url(<?php echo $page_image; ?>);"></div>
                                <?php } ?>
                            <div class="clearfix"></div>
                         </div>  
                 <?php }  // if page image is empty ?>
            <?php } // For ?>
         
    </div>
</section>