Continue reading Direct access to the query engine

Direct access to the query engine

Relevanssi can’t be used in any situation, because it checks the presence of search with the is_search() function. This causes some unfortunate limitations and reduces the general usability of the plugin. You can, however, access the query engine directly. There’s a function called relevanssi_do_query(), which can be used to do search queries just about anywhere. Here’s a…

Read more Direct access to the query engine 61 Comments on Direct access to the query engine
Continue reading Showing the number of search results

Showing the number of search results

If you want to show the number of search results found on the search results template, you can find the value in the variable $wp_query->found_posts. Just add <?php echo ‘<p>Found ‘ . $wp_query->found_posts . ‘ hits.</p>’; ?> in your search results template. In case that produces no results, try introducing the global $wp_query variable like…

Read more Showing the number of search results 4 Comments on Showing the number of search results