Continue reading Premium 1.10.5

Premium 1.10.5

Couple of bugs found, a significant improvement in the settings page and couple of new features. That’s what this version is made of. Here’s the changelog: Support for WP Table Reloaded and TablePress. Tables created with these plugins will now be expanded and the content indexed by Relevanssi. Relevanssi now adds spaces between tags when…

Read more Premium 1.10.5 9 Comments on Premium 1.10.5
Continue reading Search results in random order

Search results in random order

…the first page on it, and some posts may never appear in results. Here’s a more complicated solution that solves the issue by setting the random number generator seed every hour. Searches within that hour will return the results in the same order. This means pagination will work (unless the…

Read more Search results in random order 1 Comment on Search results in random order
Continue reading Using Relevanssi without a search term

Using Relevanssi without a search term

…} return $search_ok; } This function will trigger Relevanssi, when the query var price appears in the query. Of course, without a search term, Relevanssi will find nothing. So, you need another function attached to relevanssi_hits_filter. It needs to have something like this: add_filter( ‘relevanssi_hits_filter’, ‘rlv_hits_filter’ ); function rlv_hits_filter( $hits……$wp_query-&>query_vars[‘tax_query’] ) || isset( $wp_query->query_vars[‘meta_query’] ) ) { $search_ok = true; } return $search_ok; } Then in the hits filter, run a similar check, turn nopaging on and return the results of get_posts() with my modified query_vars. Add this to your site: add_filter( ‘relevanssi_hits_filter’, ‘rlv_hits_filter’ ); /** * return results……when there are active filters but no search term * @param array $hits $hits[0] is a list of matched WP_Post objects * $hits[1] is the search term if any * @return array $hits */ function rlv_hits_filter( $hits ) { global $wp_query; if ( ! $hits[1] && isset( $wp_query->query_vars[‘tax_query’] ) ||…

Read more Using Relevanssi without a search term 42 Comments on Using Relevanssi without a search term
Continue reading Search results breakdown by type

Search results breakdown by type

Do you want to have a breakdown of search results by post type? This could be used for example to show a list of post types like books, movies, or albums on a review site, and make them links to limit the search results to that post type. This is fairly easy to do with…

Read more Search results breakdown by type 51 Comments on Search results breakdown by type