2Hats . 1 minute
February 24, 2015

Unique native function to get the sub menu part in wp nav menu

We were working on our WordPress project and we had found a problem that when using wp_nav_menu(), there is no native function to get submenu part in another element. eg: sidebar. We found a solution which can be used to avoid this problem. Please find below code.

Just add the ‘submenu’ in the arguments for the wp_nav_menu(). Then the label name of the top-level menu that has the submenu that you want to list.

Paste this in function.php
blog
Greetings! I'm Aneesh Sreedharan, CEO of 2Hats Logic Solutions. At 2Hats Logic Solutions, we are dedicated to providing technical expertise and resolving your concerns in the world of technology. Our blog page serves as a resource where we share insights and experiences, offering valuable perspectives on your queries.
Aneesh ceo
Aneesh Sreedharan
Founder & CEO, 2Hats Logic Solutions
Subscribe to our Newsletter
Arsha Content writer

    Stay In The Loop!

    Subscribe to our newsletter and learn about the latest digital trends.