[search_filter]

The shortcode creates a dynamic filtering interface for content on a WordPress site. It supports multiple filter types (checkbox, radio, button, select) and can pull options from various sources (custom lists, taxonomies, post fields, or option fields).


Product


Shortcode Attributes

There are a number of shortcode attributes available which you can use to customize the output.

General

  1. name – Unique identifier for the filter group.
    • Options: Any text value.
  2. label – Display label for the filter.
    • Options: Any text value.
  3. placeholder – Placeholder text for select inputs.
    • Default: Select.
    • Options: Any text value.
  4. type – Filter type.
    • Default: checkbox.
    • Options: checkbox, radio, button, select. Specify one only.
  5. listing_selector – CSS selector for the element containing items to filter.
    • Options: Refer to CSS Selector Guide.
  6. choices_source – Source for filter options.
    • Default: custom.
    • Options: custom, taxonomy, post_field, option_field. Specify one only.
  7. choices – Default and values is depending on the selected choices_source value.
  8. exclude_all – Used to exclude the option all on the selection.
    • Options: yes, no. Specify one only.
  9. loadmore – Used to display a load more button on the target listing section. Please use the element load more option if there is.
    • Options: Load more button formatted value (label, initial_item, item_to_show). Example: Show more,6,3.
  10. widget – Whether to wrap the filter in a widget container.
    • Default: on.
    • Options: on, off. Specify one only.

Choice Source

For taxonomy source:

  1. choices_source – Use taxonomy.
    • Default: custom.
    • Options: custom, taxonomy, post_field, option_field. Specify one only.
  2. choices – WordPress Taxonomy slug.
    • Default: category.
    • Options: Any text value.
  3. include_children – Include child terms in taxonomy.
    • Default: no.
    • Options: no, yes. Specify one only.

For option field:

  1. choices_source – Use option_field.
    • Default: custom.
    • Options: custom, taxonomy, post_field, option_field. Specify one only.
  2. choices – Used to define the option field to get choices from. Accepts Repeater.
    • Options: Repeater Option field formatted value (repeater_field_name:sub_field_name)
      • Example: product_file_type_options:file_type.

For post field:

  1. choices_source – Use post_field.
    • Default: custom.
    • Options: custom, taxonomy, post_field, option_field. Specify one only.
  2. choices – Used to define the post field to get choices from.
    • Options: Any text value.
  3. post_type – WordPress post type / custom post type. Used to specify the post type where the post field choices will get from.
    • Default: post.
    • Options: Any text value.

For for custom:

  1. choices_source – Use custom or leave empty.
    • Default: custom.
    • Options: custom, taxonomy, post_field, option_field. Specify one only.
  2. choices – Used to define the custom search filter choices. Allow multiple values.
    • Options: selector : value formatted value. Use commas , to separate
      • Example: .red : Red.

Example Usage

[search_filter label="Categories" choices_source="taxonomy" choices="category" type="checkbox"]
[search_filter label="Filter by Size" choices="small : Small,medium : Medium,large : Large" type="radio"]

Results

Example 1:
This example displays a checkbox-based filter for categories that allows users to filter content by selecting one or more categories from the taxonomy

Example 2:
This example displays a radio button filter labeled “Filter by Size” with options for Small, Medium, and Large, allowing users to select one size at a time.
The shortcode automatically generates proper HTML structure based on the filter type.