From version 1.1, Better Search supports the use of a custom template in your WordPress theme directory to display the search results. By using the theme directory, you can customize the look and feel of the search results page and ensure that it integrates completely within your WordPress blog.
Getting Started
Better Search will look for the file called better-search-template.php
in your current themes folder. If this is found, then the plugin will use this file, otherwise it will default to the one hardcoded into the plugin.
I have included a sample template file that is created for the WordPress default theme. If you’re still using the WordPress default theme, you can copy the file into /wp-content/themes/default/
.
You can also use this template as a starting point to creating your own.
Template Tags
Better Search supports the following template tags that you can use in better-search-template.php
. Besides these you can use just about any template tag supported by WordPress
get_bsearch_title_daily
This is used to display the Title of the Daily Popular Searches heatmap. It picks up the one that is set in WP-Admin > Settings > Better Search
Syntax:
get_bsearch_title_daily($text_only = true)
Parameters:
$text_only
This will return the title stripped of all tags. This is useful if you are styling the theme and it uses a different format as that you specified for the heatmap.
Default: true
Example:
<?php echo get_bsearch_title_daily(false); ?>
This will display the title including all the tags as you entered it in WP-Admin.
get_bsearch_title
This is used to display the Title of the Overall Popular Searches heatmap. It picks up the one that is set in WP-Admin > Settings > Better Search
Syntax:
get_bsearch_title($text_only = true)
Parameters:
$text_only
This will return the title stripped of all tags. This is useful if you are styling the theme and it uses a different format as that you specified for the heatmap.
Default: true
Example:
<?php echo get_bsearch_title(false); ?>
This will display the title including all the tags as you entered it in WP-Admin.
get_bsearch_heatmap
This is used to display the heatmap for popular searches
Syntax:
get_bsearch_heatmap($daily=false, $smallest=10, $largest=20, $unit="pt", $cold="00f", $hot="f00", $before='', $after='