Forums › Forums › Search & Filter Pro › Display "Nothing was found"
Tagged: archive template, nothing found, query 0 result
- This topic has 2 replies, 2 voices, and was last updated 9 years, 5 months ago by Anonymous.
-
Anonymous(Private) July 3, 2015 at 11:16 am #20684
Hello,
I’m trying to display “Nothing was found” in my search and result template, but the last search cheched appears instead.
Here the link for an error request : http://demo.pixovor.fr/liberty-auto/recherche-vehicule/?_sfm_marque=CITROEN&_sfm_prix=0+150000&_sfm_km=0+300000&_sfm_agence=Clermont-Ferrand&_sfm_vitesse=Bo%C3%AEte+automatique&sort_order=_sfm_prix+asc+num
Here the code I use in my archive-template
`<?php if ( have_posts() ) : ?>
<div class=”container-fluid”>
<div class=”col-lg-9″>
<div class=”row”>
<?php echo do_shortcode(‘[searchandfilter id=”7881887″]’); ?>
</div>
<div class=”row”><div class=”col-md-6″></div><div class=”col-md-6″></div>
</div>
<div id=”aff-vehicules” class=”row”>
<div class=”row”>
<div class=”col-md-6″>
<p id=”nb-vehicule-result”><?php echo $wp_query->found_posts; ?> véhicules trouvés </p>
</div>
</div>
<?php /* Start the Loop */
while ( $wp_query->have_posts() ) : $wp_query->the_post();?>
<?php /* Include the post format-specific template for the content. If you want to
* this in a child theme then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part( ‘content’, ‘annonces’, get_post_format() );endwhile;?>
<div class=”pagination”><?php wp_pagenavi(); ?></div>
</div>
<?php else : ?>
<div class=”row”>
<article id=”post-0″ class=”post no-results not-found”>
<header class=”entry-header”>
<h1 class=”entry-title”><?php _e( ‘Nothing Found’, ‘twentytwelve’ ); ?></h1>
</header>
<div class=”entry-content”>
<p><?php _e( ‘It seems we can’t find what you’re looking for. Perhaps searching can help.’, ‘twentytwelve’ ); ?></p>
</div><!– .entry-content –>
</article><!– #post-0 –>
</div>
</div>
</div>
<?php endif; ?>’Thanks
Ross Moderator(Private) July 8, 2015 at 12:02 pm #21002Hey there
I didn’t get a chance to go through your code, but if you refresh the page which should have no results you will see:
There is clearly some html errors which I think is causing you problems.
Thanks
-
AuthorPosts