Per your comment:
Because I wanted the freedom to customize the HTML and CSS of the menu. I didn’t want the generated html like: ul or li tags. Plus it gives me freedom to set up my links the way I want them. – blackbull77 20 hours ago
You can do all of that with the output from
wp_nav_menu()(except for the generated<ul>and<li>tags of course – but then, those tags are semantically correct since you’re outputting a list). – Chip Bennett 19 hours agoCould you show how I can go about this? – blackbull77 44 mins ago
-
Output your list via
wp_nav_menu(), referencing thetheme_location, like so:<?php wp_nav_menu( array( 'theme_location' => 'primary_nav' ) ); ?> -
Target the
.current-menu-itemCSS class to style according to your needs - For the default fallback menu, you can also target the
.current_page_itemCSS class. - To style parent/ancestor menu items, target
.current-menu-parent,.current-menu-ancestor,.current_page_parent, and.current_page_ancestor. - To add your own, custom CSS classes, use the
nav_menu_css_classfilter.