<?php
/**
 * The front page template file
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package United Blog
 */
get_header();

if ('posts' == get_option('show_on_front')) {

    if (!is_paged() && is_front_page()) {
        get_template_part('template-parts/banner/banner-slider');
        get_template_part('template-parts/banner/featured-author');
        get_template_part('template-parts/widget-area/homepage-fullwidth-top');
        get_template_part('template-parts/widget-area/homepage-two-column');
    }

    include get_home_template();
} else {
    get_template_part('template-parts/banner/banner-slider');
    get_template_part('template-parts/banner/featured-author');

    if (!is_paged() && is_front_page()) {
        get_template_part('template-parts/widget-area/homepage-fullwidth-top');
        get_template_part('template-parts/widget-area/homepage-two-column');
        get_template_part('template-parts/widget-area/homepage-fullwidth-bottom');
    }

    do_action('newsmass_home_before_widget_area');
    ?>

    <div class="wrapper">
        <div class="row">
            <div id="primary" class="content-area">
                <main id="main" class="site-main">

                    <?php
                    while (have_posts()) : the_post();

                        get_template_part('template-parts/content', 'page');

                        // If comments are open or we have at least one comment, load up the comment template.
                        if (comments_open() || get_comments_number()) :
                            comments_template();
                        endif;

                    endwhile; // End of the loop.
                    ?>

                </main><!-- #main -->
            </div><!-- #primary -->
            <?php get_sidebar(); ?>
        </div>
    </div>

    <?php
    if ((is_front_page() || is_home()) && !is_paged()) {
        get_template_part('template-parts/widget-area/homepage-fullwidth-bottom');
        do_action('united_blog_action_featured_page');
    }
}

get_footer();
