matador_search_form( array $args ) : void
Outputs a search form for jobs.
Description
The matador_search() template function outputs a search form based on passed arguments. When used on a Matador Jobs job listing post type archive it will act as a filtering device for jobs and when used on an external page will redirect users to the active Jobs Page or job listing archive.
Parameters
array $args (optional): An associative array of arguments of the following shape:
array|string $fieldsA single-dimensional indexed array of field names or a comma-separated list of field names. Accepts ‘keyword’, ‘text’ (deprecated, use ‘keyword’), ‘id’, ‘reset’, ‘category’, ‘location’, ‘type’, and any additionally registered taxonomy names by custom code and/or extensions. Default is ‘keyword’.array|string $class: A space-separated string or single-dimensional indexed array of CSS class names to append to the enclosing HTML wrapper. Default is empty string.
Return
No return. A search form is echoed.
Examples
<?php // omit opening php tag
matador_search();
<?php // omit opening php tag
matador_search( [ 'fields' => [ 'keyword', 'id', 'category' ] );
Customize
- Modify display of output by overriding
/templates/jobs-search-form.phpor adding behavior to the existing template with its various action hooks. - Filter args before the code validates it with filter
matador_search_form_args - Filter args after the code validates it with filter
matador_search_form_args_after - Add support for additional field types with filter
matador_search_form_field_argsand output the custom field type with actionmatador_search_form_fieldby checking the passed$fieldargument.