Skip to content

Snippet: Add new classes for the theme’s custom select styles

By default the theme doesn't add the custom select dropdowns to all selects on the site because it can conflict with 3rd party plugins (such as ajax functions). That said, you can easily use a theme filter to add new classes/elements to the theme that you want to apply the custom select styles to. See the example snippet below. You can view functions.php and search for 'customSelects' if you want to see the default items to which the custom select is applied to.

add_filter( 'wpex_localize_array', function( $array ) {
	$customSelects = $array['customSelects'];
	$array['customSelects'] = $customSelects .', your-custom-class';
	return $array;
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin.
We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top