Search

Custom Filter Markup

Use paired filter tags when you want full control over the term markup inside a search form.

Custom Terms#

Wrap your markup with {{ filter:{taxonomy} }} and {{ /filter:{taxonomy} }}:

phpresources/views/front-page.php
{{ search auto }}  <input type="search" placeholder="Search">  {{ filter:category }}    <label class="filter-option">      <input>      <span>{{ name }}</span>      <small>{{ count }}</small>    </label>  {{ /filter:category }}{{ /search }}

TemplateX repeats the label once for each term.

Input Behavior#

A bare <input> becomes a working filter input. TemplateX adds the missing type, name, value, and checked state.

For a category filter, the generated input uses:

  • type="checkbox" by default
  • name="filter_category"
  • the term slug as the value
  • the current URL value to decide whether it is checked

Term Values#

Inside a paired filter, common values are:

  • {{ name }} or {{ title }}
  • {{ slug }}
  • {{ count }}, {{ amount }}, or {{ total }}
  • {{ url }}, {{ link }}, or {{ permalink }}

Use these values to build the exact filter UI your theme needs.