Joomla menus allow you to create multiple levels of navigation. This is essential for building sub-menus such as dropdowns.
Sometimes, you may only want to display one or two levels from your menu. For example, you might show the top-level links in your main navigation, and display sub-links separately in a sidebar menu.
In this post, we’ll show you how to display specific menu levels inside a Joomla sidebar module.
The menu items structure
Here’s an example of a Main Menu structure with three different levels:
Next, let’s see how we can display menu levels selectively.
Step #1. Display the menu items with a sidebar module
Joomla displays menu items through modules of the Menu type. If you don’t already have a menu module, let’s create one now.
- In your Joomla 5 administrator dashboard, go to Modules.
- This will take you to the Modules (Site) screen. Click New.
- Choose Menu to create a new menu module that will display your three-level menu structure.
- Give your module a title. In this example, we’ll call it Menu Levels.
- Assign a valid module position. We’ll use Cassiopeia’s sidebar-right.
- Under Select Menu, choose the menu that contains your items. Here, we’ll use the Main Menu.
- Click Save.
- Now check the frontend of your site to see how the menu looks.
As you can see, the Menu Levels module currently displays all three levels of menu items.
Next, let’s learn how to display specific levels of menu items, one at a time.
Step #2. Display only second-level menu items
Suppose you want to display only the Level 2 menu items in your sidebar module:
- Set the Base Item to Level 1 A.
- Set the Start Level to 2.
- Set the End Level to 2.
- Click Save.
- Check the result. The sidebar module will now display only the Level 2 menu items.
Great! You now know how to display only Level 2 menu items. But what about Level 3? Let’s find out.
Step #3. Display only third-level menu items
- Set the Base Item to Level 2 A.
- Set the Start Level to 3.
- Set the End Level to 3.
- Click Save.
- Check the result. The sidebar module will now display only the Level 3 menu items.
Well done! You can now display any menu level you want inside a Joomla sidebar module.
Finally, let’s see how to combine levels.
Step #4. Display both second and third-level menu items
You can also display both Level 2 and Level 3 menu items together:
- Set the Base Item to Level 1 A.
- Set the Start Level to 2.
- Set the End Level to 3.
- Click Save.
- Check the result:
What's Next?
Save $1,000's when you sign up for Joomlashack's Everything Club.
You will get your hands on our extensive range of over 20 extensions, plus legendary support!