{"id":234060,"date":"2020-03-02T10:35:33","date_gmt":"2020-03-02T10:35:33","guid":{"rendered":"https:\/\/www.megamenu.com\/documentation\/how-to-disable-the-sticky-menu-on-a-specific-page-copy\/"},"modified":"2020-04-28T11:35:49","modified_gmt":"2020-04-28T10:35:49","slug":"how-to-disable-the-sticky-menu-on-a-specific-page","status":"publish","type":"ht_kb","link":"https:\/\/www.megamenu.com\/documentation\/how-to-disable-the-sticky-menu-on-a-specific-page\/","title":{"rendered":"How to disable the sticky menu on a specific page"},"content":{"rendered":"<p>Add the following code to your themes functions.php page to disable the sticky menu on a specific page.<\/p>\n<pre class=\"lang:default decode:true \">function megamenu_disable_sticky_on_page( $attributes, $menu_id, $menu_settings, $settings, $current_theme_location ) {\r\n\tif ( is_page('cart') || is_page('checkout') ) {\r\n\t\t$attributes['data-sticky-desktop'] = 'false';\r\n\t\t$attributes['data-sticky-mobile'] = 'false';\r\n\t}\r\n\r\n\treturn $attributes;\r\n}\r\nadd_filter(\"megamenu_wrap_attributes\", \"megamenu_disable_sticky_on_page\", 10, 5);<\/pre>\n<p>In the example above we are detecting the &#8220;cart&#8221; page. You may find WordPress core functions including <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/is_page\/\">is_page<\/a>, <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/is_front_page\/\">is_front_page<\/a> and <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/is_single\/\">is_single<\/a> useful in detecting the correct page to disable the sticky menu on.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Add the following code to your themes functions.php page to disable the sticky menu on a specific page. function megamenu_disable_sticky_on_page( $attributes, $menu_id, $menu_settings, $settings, $current_theme_location ) { if ( is_page(&#8216;cart&#8217;) || is_page(&#8216;checkout&#8217;) ) { $attributes[&#8216;data-sticky-desktop&#8217;] = &#8216;false&#8217;; $attributes[&#8216;data-sticky-mobile&#8217;] = &#8216;false&#8217;; } return $attributes; } add_filter(&#8220;megamenu_wrap_attributes&#8221;, &#8220;megamenu_disable_sticky_on_page&#8221;, 10, 5); In the&#8230;<\/p>\n","protected":false},"author":1,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"ht-kb-category":[14],"ht-kb-tag":[],"class_list":["post-234060","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-faqs"],"uagb_featured_image_src":[],"uagb_author_info":{"display_name":"Tom Hemsley","author_link":"https:\/\/www.megamenu.com\/author\/megamenu\/"},"uagb_comment_info":0,"uagb_excerpt":"Add the following code to your themes functions.php page to disable the sticky menu on a specific page. 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...","_links":{"self":[{"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb\/234060","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/comments?post=234060"}],"version-history":[{"count":1,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb\/234060\/revisions"}],"predecessor-version":[{"id":241588,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb\/234060\/revisions\/241588"}],"wp:attachment":[{"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/media?parent=234060"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb-category?post=234060"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb-tag?post=234060"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}