- This topic has 5 replies, 3 voices, and was last updated 3 months, 1 week ago by David.
June 14, 2020 at 7:22 am #1327346Dean
I’m wondering if, for an upcoming release, a new hook location can be added for generate_before_topbar or something similar.
I know that there is already a hook for before_header — which I have found works fine even when the Header element is disabled.
But, if I put the navigation bar (customizing > layout > primary navigation “above header”) on top of the header, then the before_header hook is *below* the primary navigation.
Then, my only option is “inside_navigation” — which I don’t want as that is placed inside rather than before. There is no “before_navigation” option that I can work out. The secondary nav hook is no good either if that is not being used.
I know too there is wp_body_open — but this then is outside of the main container div for the site. I’d have to use CSS to style the contents to then fit within the container.
I also know there is a top bar and I can use widgets in that area.
But what ultimately I think would help would be a “generate_before_top_bar” — some place I can add, for example, a cookie notice or temporary alert *above* the top bar, but still inside the main div container that I specify in the Customizer for my GPP layout.
Or even just a “generate_before_navigation” location where the navigation is set to be “above header”.
While there are workarounds, I think one of these, so that there is ultimately a hook location inside the container at the very top, would be very handy.
Hopefully this is okay to submit this via support.June 14, 2020 at 4:25 pm #1327907TomLead DeveloperLead Developer
Have you played with the “Priority” option in the Element?
Things like the navigation and top bar use the same
generate_before_headerhook, but we can re-arrange things by using the Priority field. The lower the priority value, the higher up the element will display.
Let me know 🙂June 14, 2020 at 6:09 pm #1327951Dean
Thanks Tom — that’s helpful.
I was able to set the priority to 4 or lower and it appears *above* the Top Bar when using the
The only thing is, that it takes on the full-width of the browser screen, and still appears before these opening
<div class="top-bar grid-container grid-parent top-bar-align-right"> <div class="inside-top-bar grid-container grid-parent">
And then the Top Bar content appears. (It’s only below the “skip to content” code).
So I can’t “contain” the content in this position — unless I applied some CSS to the hook?
I’ve tried a “contained” page container but that doesn’t help me. Also set my top bar layout to contained, but again, the hook still is full-width.June 15, 2020 at 2:38 am #1328201DavidStaffCustomer Support
you would use the
grid-containerclass in your HTML.
e.g this would provide a full width element with an inner ‘contained’ container:
<div class="custom-top-bar"> <div class="custom-top-bar-inner grid-container"> <!-- Your HTML in here --> </div> </div>June 15, 2020 at 4:42 am #1328372Dean
Thanks David, I’ll mark it as resolved.
Ultimately, I would love to see a hook there in a future release — something that slips into the grid-container — but this of course gets me that result.June 15, 2020 at 5:10 am #1328395
- You must be logged in to reply to this topic.