How to disable the sticky menu on a specific page
Add the following code to your themes functions.php page to disable the sticky menu on a specific page.
1 2 3 4 5 6 7 8 9 |
function megamenu_disable_sticky_on_page( $attributes, $menu_id, $menu_settings, $settings, $current_theme_location ) { if ( is_page('cart') || is_page('checkout') ) { $attributes['data-sticky-desktop'] = 'false'; $attributes['data-sticky-mobile'] = 'false'; } return $attributes; } add_filter("megamenu_wrap_attributes", "megamenu_disable_sticky_on_page", 10, 5); |
In the example above we are detecting the “cart” page. You may find WordPress core functions including is_page, is_front_page and is_single useful in detecting the correct page to disable the sticky menu on.