Site logo

Archived topic

I cannot creat sticky header by GP

5 replies · Started by thetam on February 25, 2021

Viewing posts 1–6 of 6

Hello, I tryna creat a sticky header by using Hook (generate before header), im using GP, but only main nav work
I already set layout > header > Use Navigation as Header, sticky and turn on "menu sticky".
Here is my website: http://thienhabet77.net/
I want to creat a header like this: thabet.me
--
i aslo add this code to funtion.php
add_action( 'wp','db_sticky_header_navigation' );
function db_sticky_header_navigation() {
remove_action( 'generate_header', 'generate_construct_header', 10);
add_action('generate_inside_navigation', 'generate_construct_header', 10);
}

Hi there,

You seem to be trying to hitch a few elements on the nav bar's sticky functionality.

If that's the case, I don't think you need the PHP snippet you're adding in and the secondary nav bar.

You can just enable the "Use navigation as header" and create a Block or Hook element to create a secondary nav bar hooked to generate_inside_navigation so it rides in on the sticky script.

We just need a few custom CSS afterwards to fit your layout.

THANKS YOU VERY MUCH ELVIN, IT WORKS PERFECTLY

Nice one. Glad you got it sorted.

Hello, I am trying to figure out how to do this and really don't understand the terminology. I can't believe their isn't an option to make the header sticky like there is for the nav bar. Is this only possible through coding in CSS?
I want the header image (it's only 100 pixels tall) and the nav bar below it to stay fixed on each page as people scroll.
Thanks for any help!

I've just replied to your own topic.

Let's keep the conversation there.

Thanks!

This archived topic is closed to new replies.