<?php
/**
 * Created by PhpStorm.
 * User: marco
 * Date: 16/07/18
 * Time: 18.44
 */


function tour_in_elicottero_index()
{

    $content = get_component('simple_content');
    $sidebar = get_component('sidebar');
    $col_main = html5_div($content, null, 'col-md-12');
    $col_side = html5_div($sidebar, null, 'col-md-4 col-index-side');
    $row = html5_div($col_main, null, 'row');

    $title_sub = '<h2>' . get_label('Alcuni dei tour') . '</h2>';

    $sub_posts = '';
    $subs_args = array(
        'post_type' => 'tour_elicottero',
        'posts_per_page' => 999,
    );
    $the_query = new WP_Query($subs_args);

// The Loop
    if ($the_query->have_posts()) :


        while ($the_query->have_posts()) : $the_query->the_post();
            $sub_posts .= '<div class ="sub_post_item">';
            $sub_posts .= '<div class ="row">';

            $this_sub_id = get_the_ID();

            $sub_posts .= '<div class="col-lg-6">';
            $sub_posts .= '<div class="item_element item_element_title"><p>' . get_the_title($this_sub_id) . '</p>';
            $sub_posts .= '</div>';
            $sub_posts .= '</div>';

            $sub_posts .= '<div class="col-lg-3 column_giro">';
            $sub_posts .= '<div class="item_element item_element_giro"><p><i class="fa fa-clock-o" aria-hidden="true"></i> ' . get_field('giro_in_elicottero', $this_sub_id) . '</p>';
            $sub_posts .= '</div>';
            $sub_posts .= '</div>';

            $sub_posts .= '<div class="col-lg-3 column_element_link">';
            $sub_posts .= '<div class="item_element item_element_link item_element_link_tour"><p><a href="' . get_the_permalink($this_sub_id) . '">' . get_label('Dettagli') . ' <i class="fa fa-arrow-circle-o-right" aria-hidden="true"></i></a></p>';
            $sub_posts .= '</div>';
            $sub_posts .= '</div>';

            $sub_posts .= '</div></div>';
        endwhile;

    endif;
    wp_reset_query();
    wp_reset_postdata();

    $content_sub = '<div class="sub_post_index">' . $title_sub . $sub_posts . '</div>';

    $col_sub_main = html5_div($content_sub, null, 'col-md-8');
    $row_2 = html5_div($col_sub_main . $col_side, null, 'row');
    $container = html5_div($row . $row_2, null, 'container');
    $section = html5_div($container, null, 'blok');

    return $section;
}
//get_footer();