You are not buying this theme. This is only a preview for 5sec Category Search WordPress plugin which works exactly the same in all themes.

All plugin settings are located under WP admin – Settings – 5sec Category Search (screenshot 1, 2, 3).

Settings details

Settings control behaviour and display of all search forms affected by the plugin.

  • Hide Empty Terms – you can choose whether or not to hide terms that have no posts in them. Default: true.
  • Show Post Count – if checked each term will have a post count next to it, ie: category name (4) stating there are 4 posts in that category. Default: true.
  • Group Terms by Taxonomy – if you have only one taxonomy or not that many terms this option is unnecessary but for sites with many terms/taxonomies grouping them together by tax will greatly help users find the term they need. Default: false.
  • Terms Order – terms can be ordered by name, slug, post count and ID. Order can be ascending and descending. We recommend you order them by name or post count. Default: name, asc.
  • Available Taxonomies – select all taxonomies you want to show in the dropdown. All custom taxonomies will be shown here. This includes hierarchical and non hierarchical taxonomies. Following system taxonomies are hidden: post_format, link_category, nav_menu. Default: categories.
  • Execlude Terms – a comma separated list of terms you want to execlude from the dropdown. Input term ID’s or slug names; ie: 18, uncategorized. We recommend using ID-s – it’s the safest way. Default: empty.
  • Customize Search Form – if checked all search forms that use the get_search_form() function will have their HTML replaced by HTML defined in the plugin. Default: checked.
  • Customize Search Widget – if checked all search widgets their HTML replaced by HTML defined in the plugin. Default: checked.
  • Search All Post Types – if checked all public (custom) post types (except: options-tree) will be included in search. If not, only “regular” posts and pages will be searched (default WP behaviour). Default: checked.

Writing custom form HTML using the plugin

There are a few rules when it comes to writing forms. These rules imply on all WP search forms; regardless of how you create them,via our plugin or not.

  • form action URL has to be set to site’s home URL. In most cases that’s the domain name
  • search input’s field name has to be “s”. If you change the name your search wont work. ID is not important
  • form method should be GET (although POST works as well)
  • dropdown for selecting categories has to be named “scat”

We’ve prepared some template variables to make formediting easier. Please note that these variables work only if you input form HTML within theplugin. Please don’t use them in your theme files. They wont work.

  • {search_query} – user submitted search query. Use it as the value for search input field
  • {dropdown} – dropdown options with taxonomies, without <select> tag!
  • {home_url} – home URL. Use it for form action attribute

If you mess up form’s HTML there’s a “Load default HTML” button. Click it and default HTML will be loaded into the textarea.

Writing custom form HTML in theme PHP files

You can write the form’s HTML directly in theme files. Please mind the following technical details.

  • obey the usual WP search form writing rules
  • dropdown for selecting categories has to be named “scat”
  • each dropdown <option> element represents only one term
  • elemen’s description is not important but the value has to be set in the following way: taxonomy-name pipe character term-name. For the default category taxonomy that would mean: category|some-cat

If you don’t want to manually write the dropdown (we suggest you don’t do that) there are two template functions available:
the_cs_dropdown() – echoes the dropdown elements, without <select> tag!
get_cs_dropdown() – returns the dropdown elements, without <select> tag!

Example usage:

<select name="scat" id="my-fancy-dropdown">
  <?php the_cs_dropdown(); ?>