Site logo

Archived topic

New hook location

5 replies · Started by Dean on June 14, 2020

Viewing posts 1–6 of 6

Hello,

I'm wondering if, for an upcoming release, a new hook location can be added for generate_before_topbar or something similar.

I have had a look at the topic , and have read through all of the documentation I can find.

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.

Hi there,

Have you played with the "Priority" option in the Element?

Things like the navigation and top bar use the same generate_before_header hook, 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 :)

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 generate_before_header hook, thanks.

The only thing is, that it takes on the full-width of the browser screen, and still appears before these opening div codes:

<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.

Hi there,

you would use the grid-container class 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>

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.

You're welcome

This archived topic is closed to new replies.