Better Search v2.1.0
Better Search just got a bit better with v2.1.0 which I just pushed to the WordPress.org repository. This version adds a few new features, adds several more filters and also has a minor bug fix.
Cache enable / disable option
A few versions back, I implemented using transients within Better Search to cache search queries. This makes repeated searches for the same search terms much faster than before. However, the thing that was missing was the option to turn this off. With this version, the Delete Transients button sitting at the very bottom of the settings screen has been renamed and moved into General options along with an option to disable the cache.
Search form widget
Although upon activation, Better Search automatically replaces your WordPress search, many users have been asking for a search form that they could add to their WordPress blogs. You can now find a new widget as below that can be added to any widgetized area of your WordPress blog, e.g. the sidebar or the footer.
The widget is simply a wrapper for the standard WordPress function get_search_form and so supports all the features that get_search_form
would support including using your own searchform.php file in your WordPress theme.
Heatmap Shortcode:
You can now use [bsearch_heatmap] to display the popular searches anywhere in your blogs post / page content. As usual, you can continue to use the sidebar widget to display the popular searches.
The shortcode takes the same settings as the manual install code
$args = array(
'daily' => FALSE,
'smallest' => '10', // Heatmap - Smallest Font Size
'largest' => '20', // Heatmap - Largest Font Size
'unit' => 'pt', // Heatmap - We'll use pt for font size
'cold' => 'ccc', // Heatmap - cold searches
'hot' => '000', // Heatmap - hot searches
'before' => '', // Heatmap - Display before each search term
'after' => ' ', // Heatmap - Display after each search term
'heatmap_limit' => '30', // Heatmap - Maximum number of searches to display in heatmap
'daily_range' => '7', // Daily Popular will contain posts of how many days?
);
Enhancements to banned terms
v2.1.0 brings a new filter to override the censor character (currently a space). Additionally, banned terms will also be filtered from the main search query catching these very early in the process which also makes it work with seamless integration mode.
The below example shows you how to replace the censor character:
https://gist.github.com/ajaydsouza/f23f35704431485c6922
Other changes
- The plugin is now rebranded under the WebberZone umbrella
- Filters for the main query will also work for the LIKE search i.e. when the mySQL fulltext mode is turned off either manually or automatically
- Highlighting will also work even when the search term contains quotes
On the topic of quotes, an important point to understand is that Better Search uses mySQL’s fulltext contextual matching algorithm which treats every word as a phrase and ignores the use of double or single quotes.
Wrapping up…
As always, existing users can upgrade directly from within your WordPress.org install. New users can follow the simple installation instruction to install this plugin. Just search for Better Search in your Plugins > Add New screen.
If you’re looking for support, please create a new post in the support forum. This still remains the most efficient way for you to get your questions answered.
Occasionally, I do take on paid consultation at an hourly rate on a case-by-case basis. If you’re interested in this, please do drop me a line here with the details. Given the limited amount of time at my disposal, I am typically very selective on this.
If you’re looking to support this free plugin, consider sending me a donation. You can find the donation form within the plugin settings page.