Archived topic
How can I do this...
9 replies · Started by Ben on July 4, 2020
Hey Guys,
Please take a look at this little video: https://sitra.org/wp-content/uploads/2020/07/trim.B47B116F-4DE8-4B52-B8A5-D0FF20619524.mov
Is there a way to add a button in the mobile sticky menu like this?
I own that site but I'm changing theme to generatepress and I really need eith that functionality or the ability to have a button CTA visible at all times. Hopefully without the use of a plugin.
Thanks
Hi there,
you can add your button html ( or shortcode ) for example:
<a href="#">Button</a>
inside the Mobile Header using a Hook Element and selecting the inside_mobile_header hook.
Note: this the mobile-button class will be our CSS selector.
The use this CSS to hide it on static navigation:
.mobile-header-navigation:not(.is_stuck) .mobile-button {
display: none;
}
It will need some other CSS to position it - i would need to see the GP site setup to advise on that.
Hi,
Sorry for the late reply on this.
That's worked. Just need a bit of help positioning the button and the menu if you don't mind?
https://renovationrates.co.uk/
Thanks a lot.
Are you wanting a logo there?
If so can you add on in Customizer > Layout > Header --> Mobile Header
Hi, no the logo will take up too much room. I just need the elements aligning nicely if you can help?
Try this CSS to fix the alignement. And it will display logo when static and button when sticky
.mobile-header-navigation a.mobile-button {
margin: 5px auto 5px 5px;
}
.mobile-header-navigation:not(.is_stuck) a.mobile-button,
.mobile-header-navigation.is_stuck .site-logo.mobile-header-logo {
display: none;
}
Thanks, but how can we fix the layout?
I forgot to say.
Edit the button in your Hook.
So it includes the mobile-button class eg. <a class="button mobile-button"
That, sir, has worked perfectly.
Thanks so much for you help.
Generate Press and the support you guys give is FANTASTIC!
Glad to hear that = and happy to be of help