wpsl_enable_styled_dropdowns

  1. Description
  2. Usage
  3. Changelog
  4. Source File
  5. Related

Description

This filter allows you to define whether or not the styled dropdowns are used.

If this is set to false, then a default select element is used to create the dropdowns.

The default is set to true.

The filter doesn’t apply in these cases:

  • The Vertical template ignores the filter. It shows its filters in a panel instead of dropdowns. The same goes for custom templates registered with has_panel through the wpsl_templates filter.
  • On touch devices, such as phones and tablets, the other templates always use the default select element. A device counts as a touch device when it has no hover and a coarse pointer, so a laptop with a touchscreen still gets the styled dropdowns.
  • The preview on Store Locator > Appearance always shows the styled dropdowns.

Usage

This example will disable the styled dropdowns and show the default select element:

add_filter( 'wpsl_enable_styled_dropdowns', '__return_false' );

Changelog

VersionDescription
3.0Moved to includes/frontend/assets/class-resources.php. Ignored on the new Vertical template, where the value is always true. Touch devices are now detected with the (hover: none) and (pointer: coarse) media query instead of the user agent.
2.2Introduced.

Source File

This filter is located in /includes/frontend/assets/class-resources.php.

Placement

The code needs to be placed in the functions.php file inside your active theme folder.