Site logo

Archived topic

Secondary Menu in hook

2 replies · Started by Tim on February 3, 2019

Viewing posts 1–3 of 3

I am trying to get the secondary menu to display in the inside_mobile_header hook. I want the secondary menu to display in the header so that it can be sticky on top along with the header.

Example: https://imgur.com/a/y5CFS3c

The yellow bar would be the secondary menu.

I got this:

<div class="mobile-header-food-menu">
<?php
if (function_exists('has_nav_menu') && has_nav_menu('secondary')) {
	
} 
?>
</div>

That conditional evaluates to true. So all I need is the line of php that brings up the secondary menu. I have tried this:

$nav_menu = array( 'title_li' => '', 'theme_location' => 'secondary' );
                    wp_nav_menu($nav_menu);

I also tried submenu instead of secondary, both don't bring up anything.

How can I do this?

Another solution would be to have the secondary navigation stick to the bottom of the header with css I guess, but I would prefer the first method.

I think I have just found what I was after:

generate_secondary_navigation_position();

That was incredibly hard to find.

Glad you figured out!

That's definitely the best way to do this :)

This archived topic is closed to new replies.