<?php
    /*
    Template Name: Home Page Template
    */
    get_header();

    /**
    * determine main column size from actived sidebar
    */
    $main_column_size = bootstrapBasicGetMainColumnSize();
?>
<?php /* Slider */
    $images = get_field('home_page_slider');
    $count = count($images);
    if( $images ): ?>
    <div id="home-slider" class="carousel slide" data-ride="carousel">
        <!-- Indicators -->
        <ol class="carousel-indicators">
            <?php for($i = 0; $i<$count; $i++) {?>
                <li data-target="#home-slider" data-slide-to="<?php echo $i; ?>" class="<?php echo ($i==0)?'active':''; ?>"></li>
                <?php } ?>
        </ol>

        <!-- Wrapper for slides -->
        <div class="carousel-inner" role="listbox">
            <?php $i=0; foreach( $images as $image ): ?>
                <div class="item <?php if ($i==0) echo 'active'; $i++; ?>">
                    <div class="one-slide v-center" style="background: url('<?php echo $image['url']; ?>');background-size: cover;background-repeat: no-repeat;background-position: center center;">
                        <div class="container hidden-xs">
                            <div class="row">
                                <div class="col-xs-offset-7 col-xs-5">
                                    <h1 class="page-title"><?php (get_field('home_slider_title'))?the_field('home_slider_title'):_e('Introducing The GMG GT4 Signature Series Package'); ?></h1>
                                    <div class="page-content"><?php (get_field('home_slider_content'))?the_field('home_slider_content'):_e('With an emphasis on progressing what the lauded Porsche GT4 is capable of, GMG are proud to introduce out signature series package for the 918 platform.'); ?></div>
                                    <a class="read-more" href="<?php (get_field('home_slider_button_url'))?the_field('home_slider_button_url'):_e('/'); ?>"><?php (get_field('home_slider_button_text'))?the_field('home_slider_button_text'):_e('Read More'); ?></a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <?php endforeach; ?>
        </div>
    </div>
    <div class="slider-mobile-part visible-xs">
        <h1 class="page-title"><?php (get_field('home_slider_title'))?the_field('home_slider_title'):_e('Introducing The GMG GT4 Signature Series Package'); ?></h1>
        <a class="read-more" href="<?php (get_field('home_slider_button_url'))?the_field('home_slider_button_url'):_e('/'); ?>"><?php (get_field('home_slider_button_text'))?the_field('home_slider_button_text'):_e('Read More'); ?></a>
    </div>
<?php endif; ?>
<?php get_sidebar('left'); ?>
<div class="home-page">
    <div class="container-fluid">
        <div class="row">
            <?php
                while ( have_posts() ) : the_post(); ?>
                <div class="home-page-content"><?php the_content();?></div>
                <?php
                    endwhile; //resetting the page loop
                wp_reset_query(); //resetting the page query
            ?>
        </div>
    </div>
</div>
<?php get_sidebar('right'); ?> 
<?php get_footer(); ?> 