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
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?
- The topic ‘Custom function and mobile’ is closed to new replies.