<?php get_header();
if ( ! function_exists( 'elementor_theme_do_location' ) || ! elementor_theme_do_location( 'search' ) ):?>
<?php $columns = get_option(TEXT_DOMAIN . '_post_category_columns', 'col-lg-3'); ?>
    <main>
        <div class="custom-container my-4">

            <!-- page head -->
            <div class="single-page-head"
                 style="background-image: url(<?php echo get_option(TEXT_DOMAIN . '_post_category_head_image'); ?>) ">
                <div class="single-page-head-content">
                    <h1 class="single-title">جستجو برای "<?php the_search_query(); ?>"</h1>
                    <?php
                    $allsearch = new WP_Query("s=$s&showposts=0");
                    if (0 == $allsearch->found_posts) {
                        echo '<span class="text-white">'.__('Nothing found',TEXT_DOMAIN).'</span>';
                    } else {
                        echo '<span class="text-white">' . $allsearch->found_posts . ' مورد پیدا شد!</span>';
                    }
                    ?>
                </div>
            </div>


            <!-- post item large -->
            <div class="row">
                <?php if (have_posts()): ?><?php while (have_posts()): the_post(); ?>
                    <div class="<?php echo $columns ?> col-sm-6 mb-4">
                        <?php include(TEMPLATEPATH . "/inc/loop/public-item.php"); ?>
                    </div>
                <?php endwhile; ?>
                <?php else: ?>
                <div class="col-12">
                    <div class="alert alert-warning"><?php _e('Nothing found',TEXT_DOMAIN);?></div>
                </div>
                <?php endif; ?>
            </div>


            <div class="mt-5 mb-5">
                <!-- pagination -->
                <div class="bcp-pagination">
                    <?php banta_posts_navigation(); ?>
                </div>
            </div>

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