Site logo

Archived topic

How to Hook Inside Top Bar?

6 replies · Started by jhmattern on May 16, 2020

Viewing posts 1–7 of 7

On a private dev site I'm adding a menu to the top bar (not using the secondary navigation because I'm already using both navigation bars in other places). I can add a basic menu fine using the top bar widget area.

However...

I have a custom function to add login/logout links and a "my account" link for logged-in users to the end of the menu I need in the top bar. And this doesn't work if the menu is pulled in via a widget area. It needs a menu theme location.

I already did this successfully in my footer menu by registering a new menu and using GP hooks to add that menu before the copyright notice. But I can't seem to do the same in the top bar because there doesn't seem to be a way to hook into it.

Is there a hook option I'm missing that will let me insert a newly registered menu inside the top bar?

I saw another support thread where it was suggested the "before_header" hook would work, but it doesn't. When I do that, it inserts my new menu (including the login/logout links) under the top bar and before the header rather than within the top bar.

Is there any way to hook inside that top bar directly?

Thanks!

Hi there,

there is no Hook within the Top Bar.
You could of course just create your own top bar container using the before_header hook.

What else needs to go in the Top bar ?

Would that lose the ability to use other widgets there though? I currently have a widget for social media icons floating left and need the menu floating right.

Nevermind on this for now. I think it might make more sense to just merge the secondary nav back into the top bar and try to use a hook to create the lower bar beneath my primary nav. So I'm going to mark this resolved for now and will revisit if I can't get that alternative to work.

Sounds good - just re-open this topic if you need to :)

No need. The other option worked out great. Thanks!

Awesome, thanks for letting us know :)

This archived topic is closed to new replies.