Optimizing the Mobile Menu Experience

Having a website that looks great on mobile devices is more important today than ever before.

Mobile internet usage has skyrocketed over the past decade. Statistics show that over 60% of website traffic now comes from smartphones and tablets (Source).

As a webmaster with over 15 years of experience, I‘ve seen first-hand how critical it is to optimize the mobile experience. One area that often needs customization is the website menu.

The default mobile menu served up by WordPress themes doesn‘t always fit the needs of the site. Thankfully, there are a couple ways to easily hide the mobile menu in WordPress and replace it with something more suitable.

In this beginner‘s guide, we‘ll look at:

  • Using a plugin – The simplest method, great for beginners
  • Custom CSS code – For advanced users who want total control

I‘ll also share some best practices based on my own experience of managing mobile menus on client sites over the years. Let‘s dive in!

Method #1: Hide Mobile Menu with a Plugin

The easiest way to hide the default mobile menu is by using a purpose-built plugin like WP Mobile Menu.

With over 200,000 active installs, this plugin is a user-friendly way to hide the existing menu and replace it with a custom mobile version.

Why Use a Plugin?

Plugins provide a beginner-friendly way to modify the mobile menu without needing to edit any code. The entire process takes just a few minutes:

  1. Install and activate the plugin
  2. Create a new custom mobile menu
  3. Configure plugin settings to show the custom menu

Once installed, the WP Mobile Menu plugin gives you tons of options to customize the appearance, layout, behavior, and responsiveness of the mobile menu.

You can change sizing, fonts, colors, and enable useful features like sticky headers. There‘s even a tool to easily find and hide specific theme elements from mobile devices.

Potential Drawbacks

While plugins make it simple to hide and customize the mobile menu, there are some potential downsides:

  • Adds bloat by increasing the number of plugins on your site
  • Can cause conflicts with your theme or other plugins
  • Limits you to whatever options the plugin provides

So if you need ultra-precise control, a plugin may feel too restrictive. But for most users, a purpose-built plugin like WP Mobile Menu gets the job done with the least hassle.

Method #2: Using Custom CSS Code

For advanced WordPress users comfortable editing code, hiding the mobile menu with custom CSS is an option. This gives complete flexibility compared to relying on plugins.

There are two main approaches:

Hiding the Entire Default Mobile Menu

This involves finding the wrapper or container element for the default mobile menu in your theme code. You can then hide it by setting display: none.

For example, if the mobile menu container has a class of .mobile-nav, you would use:

.mobile-nav {
  display: none; 
}

This completely removes the default mobile menu from the site.

Hiding Specific Mobile Menu Items

You can also selectively show or hide certain menu items on mobile devices using custom CSS classes:

/* Hide this on mobile */
.hide-mobile {
  display: none;
}

/* Hide this on desktop */ 
.hide-desktop {
  display: none; 
}

Then just add the appropriate class to menu items you want to hide. This allows you to use one menu across desktop and mobile.

Benefits of the Custom CSS Approach

Why would you want to add custom CSS code instead of using a plugin? Here are some of the benefits:

  • Precision – Target specific elements like search bars or icons
  • No bloat – Doesn‘t add unnecessary plugins
  • Unlimited control – Go beyond basic plugin options
  • Reuse – Share code snippets between different sites

Potential Challenges

The downside of using custom CSS is it requires more technical skill:

  • Need to manually find the right CSS selectors
  • Debugging syntax errors can be tricky
  • Changes may need re-adding if the theme gets updated
  • Not as beginner-friendly compared to plugins

Best Practices for Custom CSS

When modifying code, there are a few tips I recommend based on best practices:

  • Use a plugin like WPCode to add snippets safely without editing sensitive files
  • Test extensively across desktop and mobile to catch any styling issues
  • Enable version control in WordPress so you can easily roll back issues
  • Document your code, especially complex selectors
  • Group similar snippets into files for better organization

So in summary, custom CSS allows full control over styling the mobile menu, but requires more knowledge compared to using a dedicated plugin.

Which Method Should You Use?

When it comes to hiding the mobile menu in WordPress, should you use a plugin or custom code? Here are a few key points to help decide:

  • Beginners: Start with a plugin like WP Mobile Menu. Easy to set up and configure.

  • Advanced users: Use custom CSS for precision targeting of menu elements.

  • Simple sites: A plugin is likely sufficient for basic menu hiding.

  • Complex sites: Custom code may be required for granular control.

  • On a budget: Plugin approach adds no ongoing costs.

  • Performance conscious: Custom CSS results in no added bloat.

My recommendation is to start with a plugin, and only explore custom code if you need more advanced customization.

Hopefully this gives you a good overview of the two options for hiding mobile menus in WordPress. No matter which method you choose, always be sure to test extensively across devices. A mobile menu that works beautifully on an iPhone may have issues on an Android phone.

Let me know if have any other questions! I‘m always happy to help out and share guidance based on my years as a professional webmaster.

Written by Jason Striegel

C/C++, Java, Python, Linux developer for 18 years, A-Tech enthusiast love to share some useful tech hacks.