Forums › Forums › Search & Filter Pro › "Search field" displays all results when the term isn't found
- This topic has 7 replies, 2 voices, and was last updated 8 years, 7 months ago by
Trevor.
Viewing 7 posts - 1 through 7 (of 7 total)
-
Anonymous(Private) February 20, 2017 at 4:51 pm #91473
Ooops. I tried to create a code box with bbcode but it seems it doesn’t work here. Sorry for that! Here you have it again.
<?php /** * Search & Filter Pro * * Sample Results Template * * @package Search_Filter * @author Ross Morsali * @link http://www.designsandcode.com/ * @copyright 2015 Designs & Code * * Note: these templates are not full page templates, rather * just an encaspulation of the your results loop which should * be inserted in to other pages by using a shortcode - think * of it as a template part * * This template is an absolute base example showing you what * you can do, for more customisation see the WordPress docs * and using template tags - * * http://codex.wordpress.org/Template_Tags * */ global $searchandfilter; $sf_current_query = $searchandfilter->get(21899)->current_query(); if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) { echo '<div> </div>'; } else { if ( $query->have_posts() ) { ?> Se han encontrado <strong><?php echo $query->found_posts; ?> resultados</strong><br /> <?php while ($query->have_posts()) { $query->the_post(); ?> <div class='search-filter-results-list'> <a href="<?php the_permalink(); ?>"><h2 class='search-filter-title'><?php the_title(); ?></h2> <?php if ( has_post_thumbnail() ) { echo '<div class="menu-img">'; the_post_thumbnail("full"); echo '</div>'; } ?> </a></div> <?php } ?> <?php } else { echo "No se han encontrado resultados"; } } ?>
-
AuthorPosts
Viewing 7 posts - 1 through 7 (of 7 total)