Walker Nav not really doing what I need it to…
-
I’ve been through the codex, and all over the internet… I can not find what I’m looking for and could really use some help.
I’m using the Walker setup to achieve two things:
#1 – Description
#2 – Formatting sub-navThe formatting of the sub-nav is where my issue is. I’m attempting to create a multi-column sub navigation. I achieved this with the HTML site but I’m having a lot of trouble putting it into WordPress.
This is my function for the sub-nav
function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "\n<div class=\"sub-nav\">\n"; $output .= "\n$indent<div class=\"menu-arro\"></div><div class=\"col_1\"><ul class=\"sub-menu\">\n"; } function end_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "$indent</ul></div>\n".($depth ? "$indent</div>\n" : ""); }
This is how the HTML needs to be output.
<li><a href="#" class="drop">TITLE<br> <span>Description</span></a> <div class="sub-nav"> <div class="menu-arro"></div> <div class="col_1"> <ul> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> </ul> </div> <div class="col_1"> <ul> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> </ul> </div> </div> </li>
This is my call for the navigation itself
<?php $walker = new Menu_With_Description; ?> <?php wp_nav_menu( array( 'menu' => 'Main', 'menu_class' => 'navigations', 'menu_id' => 'menu', 'walker' => $walker ) ); ?>
Now, what it’s doing for me is it’s displaying the “arrow”(which is just a CSS call), but not the actual UL columns, when viewing the source of the page it’s there but when hovering over the “Title”, it’s not actually displaying the col_1, ul/li outputs.
Am I coding something wrong on the Walker that I’m just completely missing?
The site is in development mode – https://174.132.146.250/~oct31st/contact/. Hover over “Cook”, there should be 3 clear columns there containing text but they’re not.
The nav is to mirror – https://marthastewart.com, if you hover over “Cook” you’ll see how it SHOULD be displaying (minus the featured posts on the side).
- The topic ‘Walker Nav not really doing what I need it to…’ is closed to new replies.