In my WordPress website I have the navigation requirement bit different from the provided menu functionality.In this top navigation the Tab would be the name of Category and all the page URLs under this tab would be the pages having this category associated. For example if I have an category named SPORTS and pages hockey, cricket, badminton & Tennis are associated with this category SPORTS. I need these pages in the navigation like below -
SPORTS
-Hockey
-Cricket
-Badminton
-Tennis
I want to produce HTML markup as below -
<ul>
<li>
<a href="#">**SPORTS**</a>
<ul>
<li><a href=" Hockey.html"> Hockey </a></li>
<li><a href=" Cricket.html"> Cricket</a></li>
<li><a href="cratHertz.html"> Badminton </a></li>
<li><a href=" Tennis.html"> Tennis </a></li>
</ul>
---------
</li>
-------
</ul>
I am using wp_nav_menu( $args )
. Could somebody help me in filtering/grouping the menu items/pages based on category.
EDIT - We do not require any page for SPORTS in CMS so not having any page link also on that.I can say that its just a Category Name of the pages which are coming under this tab as menu items( Hockey,Cricket etc). I am thinking an approach to print the Category names just above the Menu items of this category. I am able to print these menu items with the help of wp_nav_menu( $args ) perfectly but unable to print the category name of all the menu items(pages) just above them.
IN A NUTSHELL - I WANT TO GROUP PAGES IN THE wp_nav_menu( $args ) BASED ON THEIR ASSOCIATED CATEGORY INSIDE A LOOP RUNNING FOR ALL EACH CATEGORY.