Title: Custom function and mobile
Last modified: April 14, 2021

---

# Custom function and mobile

 *  [qwik3r](https://wordpress.org/support/users/qwik3r/)
 * (@qwik3r)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/custom-function-and-mobile/)
 * I wrote a custom function that checks if an ACF true/false field is checked, 
   and then selected it and added a mobile check: [https://share.getcloudapp.com/v1ubNnJy](https://share.getcloudapp.com/v1ubNnJy)
 * What’s happening is that the menu item is hiding on mobile regardless of if the
   true/false field is set to ‘true’. It doesn’t seem to be “listening” to the ‘
   and’ portion of your plugin.
 *     ```
       add_filter( 'if_menu_conditions', 'hide_mobile_nav' );
   
       function hide_mobile_nav( $conditions ) {
         $conditions[] = array(
           'id' =>	'hide_nav',
           'name'    =>  'Hide mobile nav', // name of the condition
           'condition' =>  function($item) {          // callback - must return TRUE or FALSE
   
   
             if ( get_field( 'hide_mobile_nav_menu' ) == '1') : 
   
                   return get_field('hide_mobile_nav_menu');
   
             endif; 
   
           }
         );
   
         return $conditions;
       }
       ```
   
 * Can you please advise?
    -  This topic was modified 5 years, 1 month ago by [qwik3r](https://wordpress.org/support/users/qwik3r/).

The topic ‘Custom function and mobile’ is closed to new replies.

 * ![](https://ps.w.org/if-menu/assets/icon-256x256.png?rev=1862232)
 * [If Menu - Visibility control for Menus](https://wordpress.org/plugins/if-menu/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/if-menu/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/if-menu/)
 * [Active Topics](https://wordpress.org/support/plugin/if-menu/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/if-menu/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/if-menu/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [qwik3r](https://wordpress.org/support/users/qwik3r/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/custom-function-and-mobile/)
 * Status: not resolved