Basic Form#
{{ search in="title|content" }} <input type="search" placeholder="Search articles"> <button>Search</button>{{ /search }}TemplateX wraps the body in a GET form. It also gives the first text-like input a name and a current value when those are missing.
Use Your Own Form Element#
If you want to write the <form> yourself, place it inside the search tag:
{{ search }} <form class="site-search"> <input type="search" placeholder="Search"> <button>Search</button> </form>{{ /search }}TemplateX keeps your form markup and adds the missing search behavior.
Options#
| Option | What it does |
|---|---|
name | Names this search when more than one search exists on the page. |
param | Changes the URL parameter. The default is q. |
parameter | Same as param. |
in | Chooses where WordPress searches. The default is title. |
search:in | Same as in. |
Search Areas#
Use pipes when the keyword should search more than one area:
{{ search in="title|content|excerpt" }} <input type="search" placeholder="Search"> <button>Search</button>{{ /search }}Supported areas are title, content, and excerpt.