-
Search Results
-
Topic: Ajax is not working
Hi,
I am pretty sure that Ajax is not working on my site at http://www.buybettermall.com/apparel . I am using the search and filter pro template which I modified to have three columns. Is it possible that my modifications wrecked something, or is it because I am using the wp_pagenavi plugin? Also when the page is loading (which it does every search right now) the multi-select filter boxes get temporarily messed up. Here is how I modified the template:if ( $query->have_posts() )
{
?><div class=”pagination”>
Found <?php echo $query->found_posts; ?> Results
<?phpif (function_exists(‘wp_pagenavi’))
{
echo “<br />”;
wp_pagenavi( array( ‘query’ => $query ) );
}
?>
</div><?php $i = 0; ?>
<?php
while ($query->have_posts())
{
$query->the_post();?>
<?php
if($i == 0) {
echo ‘<div class=”ng-row”>’;
}
?><div class=”half_bbm”>
<div id=”myfirstid”><h3>“><?php the_title(); ?></h3>
“><?php
if ( has_post_thumbnail() ) {
echo ‘<p>’;
the_post_thumbnail(“small”);
echo ‘</p>’;
}
?>
<p><?php the_excerpt(); ?><br /><p></div>
</div><?php
$i++;
if($i == 3) {
$i = 0;
echo ‘</div>’;
}
?><?php
}
?><?php
if($i > 0) {
echo ‘</div>’;
}
?>After this I didn’t change anything. Any help you can give would be appreciated. Thanks
GregHi,
How can I modify this code so that I have 3 columns showing up instead of 1?
<?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 * */ if ( $query->have_posts() ) { ?> Found <?php echo $query->found_posts; ?> Results<br /> Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br /> <div class="pagination"> <div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div> <div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div> <?php /* example code for using the wp_pagenavi plugin */ if (function_exists('wp_pagenavi')) { echo "<br />"; wp_pagenavi( array( 'query' => $query ) ); } ?> </div> <?php while ($query->have_posts()) { $query->the_post(); ?> <div> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <p><br /><?php the_excerpt(); ?><p> <?php if ( has_post_thumbnail() ) { echo '<p>'; the_post_thumbnail("small"); echo '</p>'; } ?> <p><?php the_category(); ?><p> <p><?php the_tags(); ?><p> <p><small><?php the_date(); ?></small><p> </div> <hr /> <?php } ?> Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br /> <div class="pagination"> <div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div> <div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div> <?php /* example code for using the wp_pagenavi plugin */ if (function_exists('wp_pagenavi')) { echo "<br />"; wp_pagenavi( array( 'query' => $query ) ); } ?> </div> <?php } else { echo "No Results Found"; } ?>
Topic: Display "Nothing was found"
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
Hi!
I´m using a search with 2 taxonomies which works nice on the main language (IT). But the same form does not work with on the english version of the page.
In the drop-down it shows the correct count for each taxonomy term, but I always get “no results found” back.The posts are 1700 custom-post types and they are all duplicated to english, because all custom fields are separated for each language. e.g. date_en, date_it and the template is just echoing just the fields that correspond to the current language.
This is my results.php
Thanks for any advise.
Philipp
<?php /** * Search & Filter Pro * * Sample Results Template * * @package Search_Filter * @author Ross Morsali * @link http://www.designsandcode.com/ * @copyright 2014 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 * */ if(ICL_LANGUAGE_CODE=='it'){$found="Trovato ";$res=" risultati";$nextTXT="Pagina Seguente";$prevTXT="Pagina Precedente";$lang=1;} else{$found="Found ";$res=" results";$nextTXT="Next Page";$prevTXT="Previous Page";$lang=2;} if ( $query->have_posts() ) { ?> <div id="counter"> <?php echo $query->found_posts.$res; ?><br /> </div> <ul id="catalogo-results"> <?php while ($query->have_posts()) { $query->the_post(); $tit=get_post_meta(get_the_ID(), "wpcf-titolo", true); $limit=50; // if(strlen($tit) > $limit) { //$regex = "/(.{1,$limit})\b/"; //preg_match($regex, $tit, $matches); // $tit= $matches[1]."..."; if ($lang==1){ if (trim(get_post_meta(get_the_ID(), "wpcf-titolo_pub", true))=='') { $titolo=get_post_meta(get_the_ID(), "wpcf-titolo", true); } else{ $titolo=get_post_meta(get_the_ID(), "wpcf-titolo_pub", true); } if ( (trim(get_post_meta(get_the_ID(), "wpcf-titolo_pub", true))=='')&&(trim(get_post_meta(get_the_ID(), "wpcf-titolo", true)))=='') { $notitle=true; if (trim(get_post_meta(get_the_ID(), "wpcf-tipologia_pub", true))=='' ){ $titolo=get_post_meta(get_the_ID(), "wpcf-tipologia", true);} else {$titolo=get_post_meta(get_the_ID(), "wpcf-tipologia_pub", true);} } //Autore IT if (trim(get_post_meta(get_the_ID(), "wpcf-autore_pub", true))=='') { $autore=get_post_meta(get_the_ID(), "wpcf-autore", true); } else{ $autore=get_post_meta(get_the_ID(), "wpcf-autore_pub", true); } } else { //EN if (trim(get_post_meta(get_the_ID(), "wpcf-titolo_pub_en", true))=='') { if (get_post_meta(get_the_ID(), "wpcf-titolo_pub", true)==''){ $titolo=get_post_meta(get_the_ID(), "wpcf-titolo", true); } else{ $titolo=get_post_meta(get_the_ID(), "wpcf-titolo_pub", true); } } else{ $titolo=get_post_meta(get_the_ID(), "wpcf-titolo_pub_en", true); } //Autore if (trim(get_post_meta(get_the_ID(), "wpcf-autore_pub_en", true))=='') { if (get_post_meta(get_the_ID(), "wpcf-autore_pub", true)==''){ $autore=get_post_meta(get_the_ID(), "wpcf-autore", true); } else{ $autore=get_post_meta(get_the_ID(), "wpcf-autore_pub", true); } } else{ $autore=get_post_meta(get_the_ID(), "wpcf-autore_pub_en", true); } } $tit=$titolo; $tit = (strlen($tit) > $limit) ? substr($tit,0,$limit).'...' : $tit; //} ?> <li class="box"><a href="<?php the_permalink();?>"> <div class="search-img"> <img src="/assets/js/loader.gif" data-original="http://www.lacarrara.it/catalogo-content/img/195x150/<?php echo get_post_meta(get_the_ID(), "wpcf-immagine", true);?>" class="search-img lazy" /> </div> <div class="search-text"> <div class="search-autore"> <?php echo $autore?> </div> <div class="search-titolo"> <?php echo $tit;?> </div> <div class="search-datazione"> <?php if (get_post_meta(get_the_ID(), "wpcf-datada_pub", true)!=''){ $datada=intval(get_post_meta(get_the_ID(), "wpcf-datada_pub", true)); } else { $datada=intval(get_post_meta(get_the_ID(), "wpcf-da", true)); } if (get_post_meta(get_the_ID(), "wpcf-dataa_pub", true)!=''){ $dataa=intval(get_post_meta(get_the_ID(), "wpcf-dataa_pub", true)); } else { $dataa=intval(get_post_meta(get_the_ID(), "wpcf-a", true)); } if (($dataa)==($datada)) { $datazione2=$datada; } else{ $datazione2=$datada.'-'.$dataa; } if (trim(get_post_meta(get_the_ID(), "wpcf-dataacirca_pub", true))=='true') { $datacirca =" circa"; } else{ $datacirca =""; } if ($lang==2) { if (trim(get_post_meta(get_the_ID(), "datadacirca_pub", true))=='true') { $datacirca =" approx."; } } echo $datazione2.$datacirca; ?> </div> </div> </a> </li> <?php } ?> <div class="clear"></div> <div class="pagination"> <!--Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br /> --> <div class="buttons"> <div class="nav-next button"><?php previous_posts_link( $prevTXT ); ?></div> <div class="nav-previous button"><?php next_posts_link( $nextTXT, $query->max_num_pages ); ?></div> </div> <?php /* example code for using the wp_pagenavi plugin */ if (function_exists('wp_pagenavi')) { echo "<br />"; wp_pagenavi( array( 'query' => $query ) ); } ?> </div> </ul> <?php } else { echo "No Results Found"; } ?>
The following shows the term i search as a title title if I use the search field but if I select a category from the drop down, the results are fine, the number of results displayed in the title are fine but i get an empty title:
<h1 class="search-title"> <?php echo $wp_query->found_posts; ?> <?php _e( 'Search Results Found For', 'locale' ); ?>: "<?php the_search_query(); ?>" </h1>
Becomes:
6 Search Results Found For: ""
Where between For: “..” there should be the category or categories and the search term if all have been used to make the search i suppose
Thanks