relevanssi_didyoumean not working
-
Hello,
I am trying to use the relevanssi_didyoumean feature for your plugin, but I am getting an empty result. I’m including a code snippet found in a content file that is called in the actual page template. Please let me know if you need more information:/** * The template used for displaying page content in page-all-products.php */ if(get_query_var('search') <> ''){ $args = array( 'posts_per_page' => 12, 'post_type' => 'product', 'orderby' => 'menu_order', 'order' => 'ASC', 'post_status' => 'publish', 's' => get_query_var('search') ); $query = new WP_Query( $args ); if(function_exists('relevanssi_do_query')) relevanssi_do_query( $query ); } elseif(get_query_var('application') <> '' || get_query_var('family') <> '' || get_query_var('mounting') <> '') { $taxQuery = array(); if(get_query_var('application') <> '') $taxQuery[] = array( 'taxonomy' => 'product_application', 'field' => 'slug', 'terms' => get_query_var('application'), ); if(get_query_var('family') <> '') $taxQuery[] = array( 'taxonomy' => 'product_family', 'field' => 'slug', 'terms' => get_query_var('family'), ); if(get_query_var('mounting') <> '') $taxQuery[] = array( 'taxonomy' => 'product_mounting', 'field' => 'slug', 'terms' => get_query_var('mounting'), ); if(sizeof($taxQuery) > 1) $taxQuery['relation'] = 'AND'; $args = array( 'posts_per_page' => 12, 'post_type' => 'product', 'orderby' => 'menu_order', 'order' => 'ASC', 'post_status' => 'publish', 'tax_query' => $taxQuery ); $query = new WP_Query( $args ); } else { $args = array( 'posts_per_page' => 12, 'post_type' => 'product', 'orderby' => 'menu_order', 'order' => 'ASC', 'post_status' => 'publish' ); $query = new WP_Query( $args ); } ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <header class="all-products-header"> <h1 class="all-products-title">Commercial LED Lighting</h1> <h2 class="all-products-subtitle">Kirlin Product Search</h2> </header><!-- .entry-header --> <div id="product-list-outer"> <div id="product-list-inner"> <div class="product-list-controls product-list-controls-top"> <div id="all-products-matches"><?php if($query->found_posts < 1){ if ( function_exists( 'relevanssi_didyoumean' ) ) { relevanssi_didyoumean( get_search_query( false ), 'We could\'t find any results for <strong>'.get_query_var('search').'</strong>, did you mean: ', '', 5 ); } else echo 'There aren\'t any products matching your search term, <strong>'.get_query_var('search').'</strong>'; } else { echo '<em>'.$query->found_posts.'</em>'; if($query->found_posts == 1) echo ' Product'; else echo ' Products'; if(get_query_var('search') <> '') echo ' for <strong>'.get_query_var('search').'</strong>'; } ?></div>
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘relevanssi_didyoumean not working’ is closed to new replies.