Forums › Forums › Search & Filter Pro › Search results on home page (no results)
- This topic has 3 replies, 2 voices, and was last updated 4 years, 12 months ago by Trevor.
Viewing 4 posts - 1 through 4 (of 4 total)
-
Anonymous(Private) November 28, 2019 at 10:04 am #227913
Hi there I opened a ticket closed with success https://support.searchandfilter.com/forums/topic/search-results-on-home-page/page/2/#post-224056
But I found that when I filter with no results there is no message of No Results.
The Code:
<?php global $searchandfilter; $sf_current_query = $searchandfilter->get(2611)->current_query(); if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) { echo ''; } else { ?> <?php $args = array('post_type' => 'renting'); $args['search_filter_id'] = 2611; $query = new WP_Query($args);?> <?php if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); // run the loop ?> <div class="car col-sm-6 col-md-4 wow fadeIn" data-wow-duration="1s" data-wow-delay="0.3s"> <a class="redirectClick" href="<?php the_permalink(); ?>"> <div class="item item-price" > <span class="marca"><?php the_title (''); ?></span> <span class="vehicle-finish"><?php the_field ('modelo'); ?></span> <div class="image"><img src="<?php the_post_thumbnail_url( $size ); ?>" /></div> <span class="precio categoria"><?php the_field ('precio'); ?><span class="euros-al-mes">€/mes</span><span class="iva-incluido">IVA incluido</span></span> <div class="price-canceled"></div> <div class="row categorias"> <div class="col-xs-7 kilometros categoria"><img class="icono-kilometros" src="/wp-content/uploads/2019/04/icon-kilometer.svg" alt=""><?php the_field ('km_anuales'); ?><span class="km-anuales">km anuales</span></div> <div class="col-xs-5 meses categoria"><img class="icono-meses" src="/wp-content/uploads/2019/04/icon-clock.svg" alt=""><?php the_field ('meses'); ?><span class="meses">meses</span></div> </div> </div> </a> </div> <?php endwhile; ?> <?php endif; ?> <?php wp_reset_query(); ?>
I need the filter to show no results until I press the search button, and if there are no results to show a “no results phrase”
Thanks
Any ideas? -
AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)