How to Make a WordPress Menu Only Appears on Mobile?

If you have a WordPress website, you want to make your menu look different on mobile devices. A mobile-only menu can help make your website cleaner. Also, it is easier to navigate for people on smaller screens. Today, we will show you how to create a mobile-only menu in WordPress in a few easy steps.

Steps on How to Create a Mobile-Only Menu in WordPress

Here are some easy ways you can follow to create mobile-and men in WP.

Step 1: Create a New Menu for Mobile

First, you need to create a menu that will be used on mobile devices.

  • Go to your WordPress dashboard.
  • Click on “Appearance” in the left sidebar and then click “Menus.”
  • Click “Create a new menu.”
  • Give it a name like “Mobile Menu.”

Add the links you want to show on your mobile menu. You can add pages, categories, or custom links. Once you’ve added everything, click Save Menu.

Step 2: Add a Mobile-Only Class to a Menu Item

Now, let’s make certain menu items show only on mobile devices.

  • Go back to the “Menus” page (Appearance > Menus).
  • At the top of the screen, click “Screen Options.”
  • Check the box next to “CSS Classes.” This will allow you to add special classes to menu items.
  • Find the menu item you want to appear only on mobile, then click the down arrow next to it.
  • In the CSS Classes field, type mobile-link.
  • Save the menu.

Step 3: Add CSS to Show Menu Items Only on Mobile

Next, you need to tell WordPress to only show the mobile menu on small screens. To do this, you’ll add some simple CSS code.

  • Go to “Appearance > Customize” in your WordPress dashboard.
  • Click on “Additional CSS.”
  • Paste the following code into the box:

CSS

/* Hide the mobile link by default */

.mobile-link {

    display: none;

}

/* Show the mobile link only on small screens */

@media (max-width: 768px) {

    .mobile-link {

        display: block;

    }

}
  • Click “Publish” to save the changes.

This code hides the menu items with the mobile-link class on larger screens. This only shows them on screens that are 768px or smaller (usually mobile screens).

Step 4: Test Your Mobile-Only Menu

Now that you’ve set everything up, it’s time to test your mobile-only menu.

Check your website on different devices to make sure the mobile menu looks good. Also works properly. You can use your browser’s developer tools to test the menu by resizing the window. And make sure the mobile menu appears only on smaller screens.

Conclusion

You’ve just created a mobile-only menu for your WordPress site! Now your website will look cleaner and be easier to navigate for mobile users, without affecting the desktop view. If you follow these steps, you can easily improve the user experience on your site and give your mobile visitors a better menu experience.

Good luck, and enjoy your new mobile menu!

Tiny Solutions Team

Tiny Solutions is dedicated to providing innovative and efficient WordPress plugins. Our team focuses on creating tools that simplify and enhance the WordPress experience, ensuring our users have the best possible solutions at their fingertips.

Scroll to Top