<?php get_header();

/* Template Name: Front Page */
?>

<div class="">
  
  
  
  
 <?php if ( get_theme_mod( 'howcan_breaking_news_enable', true ) ) : ?>
<section class="howcan-breaking-news bg bg-light">
  <div class="breaking-label">
    <?php echo esc_html( get_theme_mod( 'howcan_breaking_news_label', __( 'Breaking News', 'howcan' ) ) ); ?>
  </div>
  <div class="breaking-marquee">
    <?php
    $latest_post = new WP_Query(array(
        'posts_per_page' => 1,
        'post_status'    => 'publish',
        'orderby'        => 'date',
        'order'          => 'DESC',
    ));

    if ($latest_post->have_posts()) :
        while ($latest_post->have_posts()) : $latest_post->the_post();
            ?>
            <marquee behavior="scroll" direction="left" scrollamount="5" onmouseover="this.stop();" onmouseout="this.start();">
              <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
            </marquee>
            <?php
        endwhile;
        wp_reset_postdata();
    endif;
    ?>
  </div>
</section>
<?php endif; ?>


   <?php
   $default_order = 'slider,cta,features,about,pricing,blog,testimonials,newsletter';
$order = get_theme_mod( 'howcan_section_order', $default_order );
$sections = array_filter( array_map( 'trim', explode( ',', $order ) ) );

foreach ( $sections as $section ) {
    get_template_part( 'template-parts/home-page/' . $section );
}
   
   ?> 

 </div>
        
<?php get_footer(); ?>