How To Show Or Hide Different Divi Menu Items On Each Device Tutorial By Pee Aye Creative

How To Show Or Hide Different Divi Menu Items On Each Device

In this tutorial I will show you how to show or hide different WordPress menu navigation items per device in Divi.
Divi Responsive Helper by Pee Aye Creative 2.1

Join the Divi crowd!

Enable CSS Classes In WordPress Navigation Menu Items

The first step is to go to Appearance>Menus from your WordPress Dashboard. Select the menu that you want to edit.

Enable CSS Classes In Screen Options

The key thing here is to make sure CSS Classes is enabled in the Screen Options. At the top of the page, look for the “Screen Options” button, and this opens up some additional options. Find the “CSS Classes” checkbox and select it. Now, inside each menu item will be an additional field for you to add CSS classes. You’ll see what I mean in the screenshots in the next few steps.

Divi menu CSS classes screen options

Add CSS Classes To The WordPress Navigation Menu Items

Now that you have the CSS classes input field enabled, you can add a classes which we will target to hide the menu item. The CSS class is associated with the menu item. So if we target that class, we are targeting that specific menu item.

By default, a WordPress menu item will display on devices. But in Divi, we have three responsive options – Desktop, Tablet, and Phone. These are based on media queries, which we talk about in another tutorial. So what if you want to show or hide some menu items on different devices sizes?

We start with a CSS class. For the sake of this tutorial, we will keep it simple and use three classes, each will hide the menu item on a specific device size.

pa-menu-hide-desktop

pa-menu-hide-tablet

pa-menu-hide-phone

Just copy and past these classes according to which menu items you want to hide per device. You can watch the video to see this in action. Below is a screenshot to help explain this.

show or hide menu items in Divi

Add CSS Snippets To Show Or Hide Navigation Menu Items

Below you will find three CSS snippets, one for each device size in Divi. You can copy and paste them as needed. Just keep in mind that the class needs to be the same as the ones used in the menu item.

If you are using our free Divi child theme, place this snippet into the style.css file. Otherwise, place this in your Divi>Theme Options>Custom CSS code box. If you need help, check out our complete guide on Where To Add Custom Code In Divi.

Hide Menu Items On Desktop Device Sizes

/*hide menu items on Desktop device sizes*/

@media all and (min-width: 981px) {
	.pa-menu-hide-desktop {
		display: none;
	}
}

Hide Menu Items On Tablet Device Sizes

/*hide menu items on Tablet device sizes*/

@media all and (min-width: 768px) and (max-width: 980px) {
	.pa-menu-hide-tablet {
		display: none;
	}
}

Hide Menu Items On Desktop Device Sizes

/*hide menu items on Phone device sizes*/

@media all and (max-width: 768px) {
	.pa-menu-hide-phone {
		display: none;
	}
}

You can combine these snippets as needed. Just use whichever snippet you need that targets the class in the menu item. Now, when you view your menu, the items will show or hide according to the designated screen size.

Do It With A Setting!

Make life easier and use the Divi Responsive Helper instead, the ultimate Divi responsive toolkit with awesome features and settings to help make your website look and work great on all devices!

Divi Responsive Helper by Pee Aye Creative 2.1

Below is a screenshot of the responsive settings our plugin adds to the WordPress Menu items. As you can see, the checkmarks make it super easy to show or hide items on any device.

show or hide menu items per device with Divi Responsive Helper
6

Last updated Nov 16, 2021 @ 2:21 am

Please share this post!

Nelson Lee Miller (aka The Divi Teacher)

Nelson is the owner of Pee-Aye Creative in the beautiful state of Pennsylvania. He loves helping small businesses, exploring outdoors, building websites with Divi, and teaching others.

OUR ONCE A YEAR SALE IS HAPPENING NOW!!!

25% OFF all Divi Plugins, Courses, and Child Themes!

Leave A Response!

By commenting you agree to our Blog & YouTube Comments Policy

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Asset 7

Shop Our Divi Products

Plugins • Courses • Templates

Visit The Shop

Divi Adventure Club Product And Course Membership by Pee Aye Creative

Become A Member!

Gain access to everything we offer!

Learn More

Divi Tutorials On YouTube

Our videos have views! Join subscribers and enjoy over video tutorials!

Visit Our Channel

Recent Posts

Pin It on Pinterest

0

Your Cart