MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/imensosw/webofai.imenso.co/wp-content/themes/webofai_theme/search.php
<?php
/*
 * Template Name: Search Page
 * */
get_header();

$terms = get_terms('digital-marketing-tags', array(
  'hide_empty' => true,
));
$search_query = get_search_query(); // Get the search query
$paged = (get_query_var('paged') ? get_query_var('paged') : 1);
$args = array(
  'post_type' => array('tool', 'post', 'news'),
  's' => $search_query,
  'posts_per_page' => 6,
  'orderby' => 'date',
  'order' => 'DESC',
  'post_status' => 'publish',
  'paged' => $paged,
);
$the_query = new WP_Query($args);
$post_types = array('tool', 'post', 'news');
$count = array_fill_keys($post_types, 0); // Initialize the counts
$base_url = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . strtok($_SERVER['REQUEST_URI'], '?');
$base_url = preg_replace('/\/page\/\d+($|\/)/', '/', $base_url); // Remove /page/{number} from the base URL

foreach ($post_types as $post_type) {
  $post_type_args = array(
    'post_type' => $post_type,
    'numberposts' => -1,
    'post_status' => 'publish',
    's' => $search_query,
  );
  $posts = get_posts($post_type_args);
  $count[$post_type] = count($posts);
}

?>
<?php echo do_shortcode('[wpdreams_ajaxsearchlite]'); ?>
  <section class="webofai_collection_block"
           data-section-class="webofai_collection_block">
    <div class="container">
      <?php if (!$the_query->have_posts()): ?>
        <h2
          class="result-title iv-st-from-bottom"><?= __('Couldn’t find results for' . "“" . $search_query . "”", 'webofai_theme') ?></h2>
        <h4
          class="result-description iv-st-from-bottom"><?= __('Try checking your spelling. Couldn’t find the tool that you’re looking for? ', 'webofai_theme') ?></h4>
        <!--        <a href="--><?php //= site_url() . '/submit-a-tool' ?><!--" class="cta-button submit-button iv-st-from-bottom">--><?php //= __('Submit a tool', 'webofai_theme') ?><!--</a>-->
        <div data-section-class="submit_block" class="submit_block">
            <?php if (!is_user_logged_in()) { ?>
              <div class="warning-wrapper iv-st-from-bottom">
                <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'>
                  <path
                    d="M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"/>
                </svg>
                <p
                  class='warning'><?= __('Please LoggIn Before Filling The Form') ?></p>
              </div>
            <?php } ?>
            <form id="submit-tool-form" method="POST"
                  enctype="multipart/form-data">
              <div class="email input-wrapper iv-st-from-bottom">
                <label for="url"><?= __('Tool URL', 'webofai_theme') ?> <sup
                    style="color:red">*</sup></label>
                <input type="url" id="url" name="tool-url" required
                       placeholder="http://copy.ai" autocomplete="off">
              </div>
              <input type="hidden" name="submit-tool">
              <button class="cta-button submit-btn  iv-st-from-bottom"
                      type="submit"><?= __('Submit your Tool', 'webofai_theme') ?></button>
            </form>
        </div>
      <?php endif; ?>
      <div class="main-content">
        <?php if ($the_query->have_posts()): ?>
          <h2
            class="main-title iv-st-from-bottom"><?= __('Social media Assistant', 'webofai') ?></h2>
        <?php endif; ?>
        <?php if ($the_query->have_posts()) { ?>
          <div class='filter-wrapper iv-st-from-bottom'>
            <div class='filter-wrapper-content'>
              <div
                class="cat_filter_wrapper tabs-buttons <?= !$the_query->have_posts() ? 'tabs-buttons-disabled' : '' ?>">
                <button data-post-type='tool'
                        class="tab-btn <?= !$the_query->have_posts() ? 'active' : '' ?>">
                  <svg width='18' height='18' viewBox='0 0 18 18' fill='none'
                       xmlns='http://www.w3.org/2000/svg'>
                    <path
                      d='M16.4868 4.4025C16.1628 4.28098 15.7983 4.32153 15.5553 4.56457L14.3401 5.77974C14.2186 5.90126 14.1376 5.90126 14.1376 5.90126L12.1123 3.87601V3.83546L13.4896 2.45821C13.7326 2.21518 13.8136 1.85062 13.6517 1.52662C13.5301 1.20262 13.2061 1 12.8416 1C11.7885 1.04055 10.8163 1.44552 10.0467 2.17463C8.95302 3.26829 8.58847 4.88857 9.07454 6.34685V6.3874L1.66161 13.8C1.09457 14.3266 0.891951 15.0152 1.05402 15.6633C1.21609 16.2709 1.70216 16.7975 2.35016 16.9594C2.51223 17 2.63375 17 2.79568 17C3.32231 17 3.80838 16.757 4.21334 16.3519L11.5853 8.9799H11.6259C13.0841 9.46597 14.6233 9.10141 15.7168 8.08872C16.5269 7.31906 16.9726 6.30651 16.9726 5.21285C17.0133 4.84829 16.8106 4.52415 16.4866 4.40264L16.4868 4.4025ZM15.1502 7.48099C14.2995 8.29107 13.0438 8.57465 11.8692 8.2101C11.5452 8.12913 11.221 8.16955 10.978 8.41258L3.64665 15.7443C3.32265 16.0683 2.91755 16.2303 2.55299 16.1088C2.22899 16.0279 1.94541 15.7443 1.86444 15.4203C1.78347 15.0557 1.90499 14.6912 2.26955 14.3672L9.60089 7.03547C9.84392 6.79244 9.92489 6.46844 9.80337 6.1443C9.39826 4.96967 9.7224 3.67339 10.6134 2.78235C11.221 2.17476 11.9907 1.85076 12.8413 1.81021C12.8413 1.81021 12.8819 1.81021 12.8819 1.85076V1.89132L11.5046 3.26856C11.1806 3.59256 11.1806 4.15974 11.5046 4.48374L13.5299 6.50899C13.6919 6.67106 13.935 6.75203 14.2184 6.75203C14.4615 6.71147 14.6639 6.58996 14.907 6.38747L16.1627 5.13174C16.2033 5.13174 16.2033 5.17229 16.2033 5.17229C16.1628 6.06333 15.7983 6.8734 15.1502 7.48099ZM3.28203 15.1366C3.28203 15.3796 3.11996 15.5417 2.87693 15.5417C2.63389 15.5417 2.47182 15.3796 2.47182 15.1366C2.47182 14.8936 2.63389 14.7315 2.87693 14.7315C3.11996 14.7315 3.28203 14.8936 3.28203 15.1366Z'
                      fill='white' stroke='white' stroke-width='0.5'/>
                  </svg>
                  <span><?= "<b class='results-count' data-post-type='tool'>" . $count['tool'] . "</b>" . __(' Tools', 'webofai_theme') ?></span>
                </button>
                <button data-post-type='news' class="tab-btn">
                  <svg width='17' height='16' viewBox='0 0 17 16' fill='none'
                       xmlns='http://www.w3.org/2000/svg'>
                    <path
                      d='M12.311 7.33333H11.6444C11.4676 7.33333 11.298 7.40357 11.173 7.5286C11.0479 7.65362 10.9777 7.82319 10.9777 8C10.9777 8.17681 11.0479 8.34638 11.173 8.4714C11.298 8.59643 11.4676 8.66667 11.6444 8.66667H12.311C12.4878 8.66667 12.6574 8.59643 12.7824 8.4714C12.9075 8.34638 12.9777 8.17681 12.9777 8C12.9777 7.82319 12.9075 7.65362 12.7824 7.5286C12.6574 7.40357 12.4878 7.33333 12.311 7.33333ZM12.311 10H11.6444C11.4676 10 11.298 10.0702 11.173 10.1953C11.0479 10.3203 10.9777 10.4899 10.9777 10.6667C10.9777 10.8435 11.0479 11.013 11.173 11.1381C11.298 11.2631 11.4676 11.3333 11.6444 11.3333H12.311C12.4878 11.3333 12.6574 11.2631 12.7824 11.1381C12.9075 11.013 12.9777 10.8435 12.9777 10.6667C12.9777 10.4899 12.9075 10.3203 12.7824 10.1953C12.6574 10.0702 12.4878 10 12.311 10ZM8.31103 6H12.311C12.4878 6 12.6574 5.92976 12.7824 5.80474C12.9075 5.67971 12.9777 5.51014 12.9777 5.33333C12.9777 5.15652 12.9075 4.98695 12.7824 4.86193C12.6574 4.7369 12.4878 4.66667 12.311 4.66667H8.31103C8.13422 4.66667 7.96465 4.7369 7.83963 4.86193C7.71461 4.98695 7.64437 5.15652 7.64437 5.33333C7.64437 5.51014 7.71461 5.67971 7.83963 5.80474C7.96465 5.92976 8.13422 6 8.31103 6ZM14.9777 2H5.64437C5.46756 2 5.29799 2.07024 5.17296 2.19526C5.04794 2.32029 4.9777 2.48986 4.9777 2.66667V4.66667H2.9777C2.80089 4.66667 2.63132 4.7369 2.5063 4.86193C2.38127 4.98695 2.31104 5.15652 2.31104 5.33333V12C2.31104 12.5304 2.52175 13.0391 2.89682 13.4142C3.27189 13.7893 3.7806 14 4.31104 14H12.9777C13.6849 14 14.3632 13.719 14.8633 13.219C15.3634 12.7189 15.6444 12.0406 15.6444 11.3333V2.66667C15.6444 2.48986 15.5741 2.32029 15.4491 2.19526C15.3241 2.07024 15.1545 2 14.9777 2ZM4.9777 12C4.9777 12.1768 4.90746 12.3464 4.78244 12.4714C4.65742 12.5964 4.48785 12.6667 4.31104 12.6667C4.13422 12.6667 3.96465 12.5964 3.83963 12.4714C3.71461 12.3464 3.64437 12.1768 3.64437 12V6H4.9777V12ZM14.311 11.3333C14.311 11.687 14.1706 12.0261 13.9205 12.2761C13.6705 12.5262 13.3313 12.6667 12.9777 12.6667H6.19104C6.26865 12.4529 6.30923 12.2274 6.31103 12V3.33333H14.311V11.3333ZM8.31103 8.66667H8.9777C9.15451 8.66667 9.32408 8.59643 9.44911 8.4714C9.57413 8.34638 9.64437 8.17681 9.64437 8C9.64437 7.82319 9.57413 7.65362 9.44911 7.5286C9.32408 7.40357 9.15451 7.33333 8.9777 7.33333H8.31103C8.13422 7.33333 7.96465 7.40357 7.83963 7.5286C7.71461 7.65362 7.64437 7.82319 7.64437 8C7.64437 8.17681 7.71461 8.34638 7.83963 8.4714C7.96465 8.59643 8.13422 8.66667 8.31103 8.66667ZM8.31103 11.3333H8.9777C9.15451 11.3333 9.32408 11.2631 9.44911 11.1381C9.57413 11.013 9.64437 10.8435 9.64437 10.6667C9.64437 10.4899 9.57413 10.3203 9.44911 10.1953C9.32408 10.0702 9.15451 10 8.9777 10H8.31103C8.13422 10 7.96465 10.0702 7.83963 10.1953C7.71461 10.3203 7.64437 10.4899 7.64437 10.6667C7.64437 10.8435 7.71461 11.013 7.83963 11.1381C7.96465 11.2631 8.13422 11.3333 8.31103 11.3333Z'
                      fill='#2E2E2E'/>
                  </svg>
                  <span><?= "<b class='results-count' data-post-type='news'>" . $count['news'] . "</b>" . __(' News', 'webofai_theme') ?></span>
                </button>
                <button data-post-type='post' class="tab-btn">
                  <svg width='17' height='16' viewBox='0 0 17 16' fill='none'
                       xmlns='http://www.w3.org/2000/svg'>
                    <g clip-path='url(#clip0_1835_1831)'>
                      <path
                        d='M8.97778 9.33311C8.91112 9.33311 8.84445 9.33311 8.77778 9.26644L1.44445 6.59977C1.17778 6.5331 0.977783 6.26644 0.977783 5.99977C0.977783 5.73311 1.17778 5.46644 1.44445 5.39977L8.77778 2.73311C8.91112 2.66644 9.11112 2.66644 9.24445 2.73311L16.5778 5.39977C16.7778 5.46644 16.9778 5.73311 16.9778 5.99977C16.9778 6.26644 16.7778 6.5331 16.5111 6.59977L9.17778 9.26644C9.11112 9.33311 9.04445 9.33311 8.97778 9.33311ZM3.57778 5.99977L8.97778 7.9331L14.3778 5.99977L8.97778 4.06644L3.57778 5.99977Z'
                        fill='#2E2E2E'/>
                      <path
                        d='M13.6444 13.3332H8.9777C8.5777 13.3332 8.31104 13.0666 8.31104 12.6666C8.31104 12.2666 8.5777 11.9999 8.9777 11.9999H12.9777C12.911 10.2666 12.511 8.79991 11.8444 7.73324C11.6444 7.39991 11.7777 6.99991 12.0444 6.79991C12.3777 6.59991 12.7777 6.73324 12.9777 6.99991C13.8444 8.39991 14.311 10.3332 14.311 12.5999C14.311 13.0666 14.0444 13.3332 13.6444 13.3332Z'
                        fill='#2E2E2E'/>
                      <path
                        d='M8.97786 13.3335H4.3112C3.9112 13.3335 3.64453 13.0668 3.64453 12.6668C3.64453 10.4002 4.1112 8.46683 4.97786 7.06683C5.17786 6.7335 5.57786 6.66683 5.9112 6.86683C6.24453 7.06683 6.3112 7.46683 6.1112 7.80016C5.44453 8.86683 5.04453 10.3335 4.97786 12.0668H8.97786C9.37786 12.0668 9.64453 12.3335 9.64453 12.7335C9.64453 13.1335 9.37786 13.3335 8.97786 13.3335ZM15.6445 13.3335C15.2445 13.3335 14.9779 13.0668 14.9779 12.6668V6.00016C14.9779 5.60016 15.2445 5.3335 15.6445 5.3335C16.0445 5.3335 16.3112 5.60016 16.3112 6.00016V12.6668C16.3112 13.0668 16.0445 13.3335 15.6445 13.3335Z'
                        fill='#2E2E2E'/>
                    </g>
                    <defs>
                      <clipPath id='clip0_1835_1831'>
                        <rect width='16' height='16' fill='white'
                              transform='translate(0.977783)'/>
                      </clipPath>
                    </defs>
                  </svg>
                  <span><?= "<b class='results-count' data-post-type='post'>" . $count['post'] . "</b>" . __(' Resources', 'webofai_theme') ?></span>
                </button>
              </div>
              <!--Select2-->
              <div class="sort-select-wrapper">
                <p
                  class='place-holder'><?= __('Sort by ', 'webofai_theme') ?></p>
                <select class='sort_select filter'>
                  <option
                    value='DESC'><?= __('Revelance', 'webofai_theme') ?></option>
                  <option
                    value="ASC"><?= __('Irrevelance', 'webofai_theme') ?></option>
                </select>

              </div>
            </div>
            <?php if ($terms && $the_query->have_posts()) { ?>
              <div class="swiper-container iv-st-from-bottom">
                <div class='swiper mySwiper  '>
                  <div class='swiper-wrapper'>
                    <?php foreach ($terms as $term) { ?>
                      <div class='swiper-slide'>
                        <button data-slug="<?= $term->slug ?>"
                                class='taxonomy-filter cta-button'><?= $term->name ?></button>
                      </div>
                    <?php } ?>
                  </div>
                  <div class='swiper-button-prev'>
                    <svg width='24' height='24' viewBox='0 0 24 24' fill='none'
                         xmlns='http://www.w3.org/2000/svg'>
                      <path d='M9 18L15 12L9 6' stroke='#8690A2'
                            stroke-width='1.5'
                            stroke-linecap='round' stroke-linejoin='round'/>
                    </svg>
                  </div>
                  <div class='swiper-button-next'>
                    <svg width='24' height='24' viewBox='0 0 24 24' fill='none'
                         xmlns='http://www.w3.org/2000/svg'>
                      <path d='M9 18L15 12L9 6' stroke='#8690A2'
                            stroke-width='1.5'
                            stroke-linecap='round' stroke-linejoin='round'/>
                    </svg>

                  </div>


                </div>

              </div>
            <?php } ?>
          </div>
        <?php } else {
          echo "<div class='filter-wrapper-content iv-st-from-bottom no-padding'></div>";
        } ?>
        <div class="cards-wrapper" data-base-url="<?= $base_url ?>">
          <?php if ($the_query->have_posts()) { ?>
            <div class='grid-cards cards-container' posts-container>
              <?php while ($the_query->have_posts()) {
                $the_query->the_post();
                get_template_part('partials/tool-card', '', array('post_id' => get_the_ID()));
              } ?>
            </div>
            <?php
            \Theme\Helpers::get_paginate_links($the_query, $paged);
            wp_reset_postdata(); ?>
          <?php } else {
            $args = array(
              'post_type' => 'tool',
              'posts_per_page' => 6,
              'orderby' => 'date',
              'order' => 'DESC',
              'post_status' => 'publish',
              'paged' => $paged,
            );
            $the_query = new WP_Query($args);
            ?>
            <h2
              class="main-title main-title-secondary iv-st-from-bottom"><?= __('Tools you might like', 'webofai') ?></h2>
            <div class='grid-cards cards-container' posts-container>
              <?php while ($the_query->have_posts()) {
                $the_query->the_post();
                get_template_part('partials/tool-card', '', array('post_id' => get_the_ID()));
              } ?>
            </div>
            <?php wp_reset_postdata(); ?>
          <?php } ?>
          <?php $args['paged'] = 2; ?>
          <div
            class="no-posts headline-2 <?= $the_query->have_posts() ? '' : 'active' ?>">
            <?= __('No Posts Here :(', 'webofai_theme') ?></div>
          <div
            class="load-more-wrapper  <?= $the_query->max_num_pages <= 1 ? 'hidden' : '' ?>"
            data-args='<?= json_encode($args) ?>'
            data-action='webofai_collection_ajax'
            data-template="partials/tool-card">
            <button aria-label="Load More "
                    class="cta-button  load-more-btn"><?= __('Load More', 'webofai_theme') ?>
            </button>
            <div class="loader">
              <div class="loader-ball"></div>
              <div class="loader-ball"></div>
              <div class="loader-ball"></div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>
<?php
get_footer();