1. Home
  2. Car Demon Code Docs
  3. Form Filters
  4. cd_search_form_filter

cd_search_form_filter

This filter will allow you to modify the different vehicle search forms.

apply_filters( ‘cd_search_form_filter’, $form, $type¬†);

Parameters

$form – The current HTML for the search form.
$type – The different form type. Exp: search_box, full, small

add_filter( 'cd_search_form_filter', 'my_search_form', 10, 2 );
function my_search_form( $form, $type ) {

    if ( 'search_box' === $type ) {

        $form = '<div class="my_class">' . $form . '</div>';

    }

    return $form;
}

The above example checks to see if the form type is “search_box” and if it is then it wraps it in a <div> tag with a CSS class of “my_class”.

Was this article helpful to you? Yes No

How can we help?