<?php
/**
 * The template for displaying search results pages
 *
 * @package Zentorone
 */

get_header();
?>

<div class="container">
    <div class="row">
        <div class="<?php echo esc_attr( zentorone_column_classes( 'main' ) ); ?>">
            <main id="primary" class="site-main">

                <?php if ( have_posts() ) : ?>

                    <header class="page-header mb-5 border-bottom pb-3">
                        <h1 class="page-title h3">
                            <?php
                            /* translators: %s: search query. */
                            printf( esc_html__( 'Search Results for: %s', 'zentorone' ), '<span class="text-primary">' . get_search_query() . '</span>' );
                            ?>
                        </h1>
                    </header><!-- .page-header -->

                    <?php
                    /* Start the Loop */
                    while ( have_posts() ) :
                        the_post();

                        /**
                         * Run the loop for the search to output the results.
                         * If you want to overload this in a child theme then include a file
                         * called content-search.php and that will be used instead.
                         */
                        get_template_part( 'template-parts/content/content', 'search' );

                    endwhile;

                    the_posts_navigation( array(
                        'prev_text' => '<i class="bi bi-arrow-left me-2"></i>' . esc_html__( 'Older posts', 'zentorone' ),
                        'next_text' => esc_html__( 'Newer posts', 'zentorone' ) . '<i class="bi bi-arrow-right ms-2"></i>',
                        'class'     => 'posts-navigation d-flex justify-content-between mt-4'
                    ) );

                else :

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

                endif;
                ?>

            </main><!-- #main -->
        </div><!-- .col -->

        <?php if ( zentorone_get_option( 'zentorone_global_layout', 'right-sidebar' ) !== 'full-width' && zentorone_get_option( 'zentorone_global_layout', 'right-sidebar' ) !== 'no-sidebar' ) : ?>
            <div class="<?php echo esc_attr( zentorone_column_classes( 'sidebar' ) ); ?> <?php echo esc_attr( ( zentorone_get_option( 'zentorone_global_layout', 'right-sidebar' ) === 'left-sidebar' ) ? 'order-first' : '' ); ?>">
                <?php get_sidebar(); ?>
            </div>
        <?php endif; ?>
    </div><!-- .row -->
</div><!-- .container -->

<?php
get_footer();
