Site logo

Archived topic

Remove all JavaScript and Mobile menu?

3 replies · Started by Kev on May 21, 2022

Viewing posts 1–4 of 4

Hey there,

I'm working on a re-design of my site, and I'm going with a brutal design. Do achieve that, I don't want any kind of hamburger menu on mobile devices. I can't seem to find a way of disabling the hamburger menu in the customiser though. Is this even possible from customiser, or would I need to add some custom CSS that removes the @media queries?

I'd also like to remove all javascript. It's not needed anywhere on my site (once the mobile menu is gone) so loading Jquery and other JS is just a waste. How do I do that?

Thanks folks!

Hi there,

1. ensure you do NOT have the Mobile Header enabled in Customizer > Layout > Header.
2. set the Mobile Menu Breakpoint to 0 in Customizer > Layout > Primary Navigation.
3. Dequeue any menu related scripts ( NOTE: this includes Drop downs ) with this PHP Snippet:

add_action( 'wp_enqueue_scripts', 'tu_remove_menu_scripts', 50 );
function tu_remove_menu_scripts() {
    wp_dequeue_script( 'generate-menu' );
    wp_dequeue_script( 'generate-dropdown' );
}

GP only loads the scripts it needs. And the only jQuery dependency is the Sticky Navigation.

That worked. Thanks David.

Glad to be of help

This archived topic is closed to new replies.