{"id":4295,"date":"2022-09-16T02:03:19","date_gmt":"2022-09-16T02:03:19","guid":{"rendered":"https:\/\/docs.contentviewspro.com\/?p=4295"},"modified":"2023-12-29T08:23:29","modified_gmt":"2023-12-29T08:23:29","password":"","slug":"live-filter-use-dropdown-type-on-mobile-devices","status":"publish","type":"docs","link":"https:\/\/contentviewspro.com\/documentation\/article\/live-filter-use-dropdown-type-on-mobile-devices\/","title":{"rendered":"Live Filter \u2013 use Dropdown type on mobile"},"content":{"rendered":"<p>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 <strong>functions.php<\/strong> in the theme&#8217;s folder (or install this plugin <a href=\"https:\/\/wordpress.org\/plugins\/code-snippets\/\" rel=\"nofollow\">Code Snippets<\/a> then add this code to <a href=\"https:\/\/ps.w.org\/code-snippets\/assets\/screenshot-2.png\" rel=\"nofollow\">the &#8220;Code&#8221; textarea<\/a>):<\/p>\n<pre style=\"font-size:13px\">\n\/\/ Content Views Pro - Use dropdown for Live Filter on mobile devices. @since > 5.6.0.2\nadd_filter( 'pt_cv_lf_type', 'cvp_theme_lf_type_mobile', 100, 2 );\nfunction cvp_theme_lf_type_mobile( $args, $name ) {\n\tglobal $pt_cv_id;\n\t\n\t\/* To apply for all live filter views, replace below code with\n\t$applied = true;\n\t *\/\n\t$applied = in_array( $pt_cv_id, array( 'VIEW_ID_1', 'VIEW_ID_2', 'VIEW_ID_3', 'VIEW_ID_4', 'VIEW_ID_5' ) );\n\n\tif ( $applied && $args != 'search_field' && PT_CV_Functions_Pro::check_device( 'mobile' ) ) {\n\t\t$args = 'dropdown';\n\t}\n\treturn $args;\n}\n\n<\/pre>\n<p>(please replace <strong>VIEW_ID_1, VIEW_ID_2, &#8230;<\/strong> with <a href=\"https:\/\/contentviewspro.com\/documentation\/article\/what-is-id-of-a-view\/\">ID of your Views<\/a>)<\/p>\n<p>Best regards,<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;s folder (or install this plugin Code Snippets then add this code to the &#8220;Code&#8221; textarea): \/\/ Content Views Pro &#8211; Use dropdown for &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/contentviewspro.com\/documentation\/article\/live-filter-use-dropdown-type-on-mobile-devices\/\"> <span class=\"screen-reader-text\">Live Filter \u2013 use Dropdown type on mobile<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"doc_category":[46],"doc_tag":[35],"class_list":["post-4295","docs","type-docs","status-publish","hentry","doc_category-live-filter","doc_tag-live-filter"],"year_month":"2026-11","word_count":148,"total_views":"2","reactions":{"happy":"0","normal":"0","sad":"0"},"author_info":{"name":"admin1","author_nicename":"admin1","author_url":"https:\/\/contentviewspro.com\/documentation\/author\/admin1\/"},"doc_category_info":[{"term_name":"Live Filter (Frontend Search &amp; Filter)","term_url":"https:\/\/contentviewspro.com\/documentation\/cats\/live-filter\/"}],"doc_tag_info":[{"term_name":"live filter","term_url":"https:\/\/contentviewspro.com\/documentation\/tags\/live-filter\/"}],"_links":{"self":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/4295","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/comments?post=4295"}],"version-history":[{"count":2,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/4295\/revisions"}],"predecessor-version":[{"id":5647,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/4295\/revisions\/5647"}],"wp:attachment":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/media?parent=4295"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/doc_category?post=4295"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/doc_tag?post=4295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}