<?php /* Template Name: Homepage */ ?>
<?php get_header(); ?>
<?php
$stiri_category = get_category(2);
$tranzit_category = get_category(2125);
$logistica_category = get_category(4);
$excluded_ids_news = [];
$excluded_ids_tranzit = [];
$excluded_ids_logistica = [];
?>
<?php ob_start(); wc_print_notices(); ?>
<section class="hero mt-20">
<div class="container">
<div class="row">
<div class="col hero-slider hero-slider-type-<?php the_field('hero_slider_display'); ?>" data-autorun="<?php the_field('hero_slider_auto-run'); ?>" data-speed="<?php the_field('hero_slider_speed'); ?>">
<?php
$rows = get_field('hero_slider');
if($rows): ?>
<div class="hero-slider-wrapper">
<?php
if(get_field('hero_slider_shuffle') == 'Da') {
shuffle( $rows );
}
foreach($rows as $row): ?>
<?php
$excluded_ids_news[] = $row['articol'];
$excluded_ids_tranzit[] = $row['articol'];
$excluded_ids_logistica[] = $row['articol'];
?>
<?php echo do_shortcode('[article_big article_id="' . $row['articol'] . '" type="' . get_field('hero_slider_display') . '"]'); ?>
<?php endforeach; ?>
</div>
<div class="hero-slick-arrows-wrapper"></div>
<div class="hero-slick-dots-wrapper"></div>
<?php endif; ?>
</div>
<div class="col sidebar_right_padding">
<?php echo do_shortcode('[ad_zone adzone_id="' . get_field('hero_sidebar') . '" display="desktop-ad"]'); ?>
<?php echo do_shortcode('[ad_zone adzone_id="' . get_field('hero_sidebar_tableta') . '" display="tablet-ad"]'); ?>
<?php echo do_shortcode('[ad_zone adzone_id="' . get_field('hero_sidebar') . '" display="mobile-ad"]'); ?>
</div>
</div>
</div>
</section>
<section class="section-latest mt-24 mb-44">
<div class="container">
<div class="section-title">
<h4 class="title"><?php echo get_field('latest_section_title'); ?></h4>
<div id="section-latest-arrows-wrapper"></div>
</div>
<?php
$latest_count = get_field('latest_number');
$latest_args = [
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page'=> (intval($latest_count) > 0 ? $latest_count : 3),
'order' => 'DESC',
'orderby' => 'post_date',
'meta_query' => [
[
'key' => '_thumbnail_id',
'compare' => 'EXISTS'
],
]
];
$latest_query = new WP_Query( $latest_args );
?>
<div class="row section-latest-wrapper">
<div class="col section-latest-slider">
<?php
if ( $latest_query->have_posts() ):
while ( $latest_query->have_posts() ):
$latest_query->the_post();
$excluded_ids_news[] = get_the_ID();
$excluded_ids_tranzit[] = get_the_ID();
$excluded_ids_logistica[] = get_the_ID();
echo do_shortcode('[article_latest article_id="' . get_the_ID() . '" type="portret"]');
endwhile;
endif;
/* Restore original Post Data */
wp_reset_postdata(); ?>
</div>
</div>
</div>
</section>
<section class="section-banner mb-40">
<div class="container">
<?php echo do_shortcode('[ad_zone adzone_id="' . get_field('latest_ads_section') . '"]'); ?>
<?php echo do_shortcode('[ad_zone adzone_id="' . get_field('latest_ads_section_tableta') . '" display="tablet-ad"]'); ?>
</div>
</section>