<?php

/**
 * The template for displaying the footer
 *
 * Contains the closing of the #content div and all content after.
 *
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @package faced
 */

?>
</div> <!-- #content -->
<?php 
    global $faced_theme_options;
    $featured_title = esc_html($faced_theme_options['faced-related-post-section-title']);
    $featured_cat = absint($faced_theme_options['faced-related-post-select-category']);
    $enable_footer_post = absint($faced_theme_options['faced-footer-post-enable']);
?>
<?php if($enable_footer_post): ?>
    <section class="feat-section">
        <div class="container">
            <div class="feat-section-items-wrap">

            
                <div class="feat-section__title">
                    <?php if($featured_title): ?>
                        <h4><?php echo $featured_title; ?></h4>
                    <?php endif; ?>
                </div>
                <div class="feat-section__post-wrap row-full-width">
                    <?php
                    $args = array(
                        'posts_per_page' => 4,
                        'post_type' => 'post',
                        'orderby' => 'post_date',
                        'order' => 'DESC',
                        'post_status' => 'publish',
                        'cat' => $featured_cat,
                    );
                    $query = new WP_Query($args);
                    /* Start the Loop */
                    while ($query->have_posts()) :
                        $query->the_post();
                        /*
                        * Include the Post-Type-specific template for the content.
                        * If you want to override this in a child theme, then include a file
                        * called content-___.php (where ___ is the Post Type name) and that will be used instead.
                        */
                        get_template_part('template-parts/content-featured', get_post_type());

                    endwhile;
                    ?>
                </div>
            </div>
        </div>
    </section>
<?php endif; ?>
<!-- .feat-section -->

<?php
/**
 * faced_newsletter hook.
 *
 * @since 1.0.0
 *
 * @hooked faced_construct_newsletter - 10
 *
 */
do_action('faced_newsletter');
?>

<footer id="colophon" class="site-footer">
    <?php
    if (is_active_sidebar('footer-1') || is_active_sidebar('footer-2') || is_active_sidebar('footer-3')) {
    ?>
        <section class="site-footer-top">
            <div class="container">
                <div class="row">
                    <?php
                    if (is_active_sidebar('footer-1')) {
                    ?>
                        <div class="col-12 col-sm-1-1 col-md-1-3">
                            <?php dynamic_sidebar('footer-1'); ?>
                        </div>
                    <?php
                    }
                    if (is_active_sidebar('footer-2')) {
                    ?>

                        <div class="col-12 col-sm-1-1 col-md-1-3">
                            <?php dynamic_sidebar('footer-2'); ?>
                        </div>
                    <?php
                    }
                    if (is_active_sidebar('footer-3')) {
                    ?>
                        <div class="col-12 col-sm-1-1 col-md-1-3">
                            <?php dynamic_sidebar('footer-3'); ?>
                        </div>
                    <?php
                    }
                    ?>
                </div>
            </div>
        </section>
    <?php
    }
    ?>
    <section class="site-footer-bottom">
        <div class="container">
            <div class="faced-menu-social">
                <?php
                /**
                 * faced_footer_social hook.
                 *
                 * @since 1.0.0
                 *
                 * @hooked faced_construct_footer_social - 10
                 *
                 */
                do_action('faced_footer_social');
                ?>
            </div>
            <?php
            /**
             * faced_footer_info_texts hook.
             *
             * @since 1.0.0
             *
             * @hooked faced_footer_copyright - 10
             * @hooked faced_footer_theme_info - 20
             *
             */
            do_action('faced_footer_info_texts');
            ?>
        </div>
    </section>
</footer><!-- #colophon -->
</div><!-- #page -->

<?php
/**
 * faced_construct_gototop hook
 *
 * @since 1.0.0
 *
 */
do_action('faced_gototop');

wp_footer(); ?>

</body>

</html>
