• Hi, I was trying to add a custom dropdown filter. In our case we want to have one filter for days and for part of the day, e.g. “Friday & Morning”. I tried the following below, which was specified in the 2.2 release post.

    $output .= ‘<select autocomplete=”off” name=”cars” class=”wpsl-dropdown wpsl-custom-dropdown”>’;
    $output .= ‘<option value=”0″>Any cars</option>’;
    $output .= ‘<option value=”bmw”>BMW</option>’;
    $output .= ‘<option value=”mercedes”>Mercedes</option>’;
    $output .= ‘</select>’;

    Were on the backend can I specify or have to specify this filter, so that it actually communicates? I did the days with categories, which obviously built in.

    Thanks in advance

Viewing 1 replies (of 1 total)
  • Plugin Author Tijmen Smit

    (@tijmensmit)

    The first section of this article explains how to create a custom field in the admin area.

    The filter it uses is this one. On line 23 in the usage section you can see how to set the type so it creates a custom dropdown field. This allows you to set the value for each location to the custom dropdown values.

    When a user makes a search and uses the custom dropdown, then the value is automatically included in the AJAX call. You do need to change the SQL query so that it includes the correct meta field. You can do this with the wpsl_sql and wpsl_sql_placeholders filter.

Viewing 1 replies (of 1 total)

The topic ‘Adding a custom dropdown filter’ is closed to new replies.