Live Filter – use Dropdown type on mobile

If you want to use another live filter type in desktop and tablet devices, but use the Dropdown type on mobile devices, please add this code to file functions.php in the theme’s folder (or install this plugin Code Snippets then add this code to the “Code” textarea):

// Content Views Pro - Use dropdown for Live Filter on mobile devices. @since > 5.6.0.2
add_filter( 'pt_cv_lf_type', 'cvp_theme_lf_type_mobile', 100, 2 );
function cvp_theme_lf_type_mobile( $args, $name ) {
	global $pt_cv_id;
	
	/* To apply for all live filter views, replace below code with
	$applied = true;
	 */
	$applied = in_array( $pt_cv_id, array( 'VIEW_ID_1', 'VIEW_ID_2', 'VIEW_ID_3', 'VIEW_ID_4', 'VIEW_ID_5' ) );

	if ( $applied && $args != 'search_field' && PT_CV_Functions_Pro::check_device( 'mobile' ) ) {
		$args = 'dropdown';
	}
	return $args;
}

(please replace VIEW_ID_1, VIEW_ID_2, … with ID of your Views)

Best regards,

Scroll to Top