- This topic has 15 replies, 4 voices, and was last updated 2 years, 11 months ago by David.
-
AuthorPosts
-
November 24, 2020 at 6:50 am #1544394Matt
Hi,
I’m trying to make a custom template for a membership site. I need to create the external pages (register, sign-in, T’s and C’s) and I want to remove the header on these pages.
I have used the generate_header hook to remove the main header markup (https://docs.generatepress.com/article/generate_header/) but this doesn’t remove the mobile nav on smaller screens. Is there a specific hook I should be looking for?
Thanks
November 24, 2020 at 10:29 am #1544836LeoStaffCustomer SupportHi there,
Any chance you can link us to the site in question?
You can use the private information field.
Let me know ๐
November 24, 2020 at 2:44 pm #1545186MattHi Leo,
I think I found the hook I was looking for:
add_action( 'generate_after_header', 'generate_menu_plus_mobile_header', 5 )
I have removed this action and it seems to be doing what I was wanting.
ie
if ( ! is_user_logged_in() ) { remove_action( 'generate_after_header', 'generate_menu_plus_mobile_header'); }
Thanks
November 24, 2020 at 2:48 pm #1545191LeoStaffCustomer SupportYou can actually just create a layout element for that:
https://docs.generatepress.com/article/layout-element-overview/#disable-elementJust disable the Site Header and the Mobile Header.
November 24, 2020 at 2:50 pm #1545193MattTo remove the sites mobile navigation?
November 24, 2020 at 2:51 pm #1545196LeoStaffCustomer SupportYup – the site header and the mobile header is separated which is why your original solution didn’t work for mobile.
Creating a layout element would be the best solution.
November 24, 2020 at 3:10 pm #1545211MattThat’s awesome. So just to be clear on how it works…..
1. Set up an Element of type ‘Layout’.
2. Disable any of the elements that I don’t want to show to non-logged in users
3. On ‘Display Rules’ tab – Set the location to ‘Entire Site’ and the Users to ‘Logged out Users’This will then over-ride page Layout settings for any page when the user isn’t logged in?
Thanks
November 25, 2020 at 8:58 am #1546661LeoStaffCustomer SupportThat sounds correct.
Try it first?
January 25, 2021 at 7:25 pm #1633552MattHi,
Just a follow up to this topic. Is there a way with the “Elements” module to remove the mobile navigation, but not the mobile header (logo etc)?
Thanks
January 26, 2021 at 9:41 am #1634542TomLead DeveloperLead DeveloperIf you remove the primary navigation using Disable Elements, that should happen.
However, it also disables the primary nav on desktop, which may not be what you’re looking for?
In that case, your best bet is to use CSS to hide the toggle in the mobile header:
#mobile-header .menu-toggle { display: none; }
January 26, 2021 at 3:01 pm #1634905MattHi Tom,
That was my understanding too but it’s not what I am seeing.
What I am trying to do is remove the menu for any user that is logged out (at any screensize).
Using the Elements module, I have set up layout for Logged Out Users that disables Primary Navigation. The display rules are set to Location – “Entire Site” and Users -“Logged Out”.
When I view the site in incognito (ie. logged out) this seems to work for desktop size (navigation is not rendered in HTML), but the mobile menu is still being generated and displayed.
January 27, 2021 at 9:47 am #1635964TomLead DeveloperLead DeveloperAha, it seems it’s only set up when using the Disable Elements metabox on the actual page (not via Elements).
This is definitely a bug – it should work with Elements as well. I’ll be sure to get this added in the next GPP version (alpha coming next week).
For now, you can use the Disable Elements feature on the page, or some simple CSS to hide it for logged-out users.
Let me know if you need more info ๐
February 7, 2021 at 7:35 pm #1649709MattHi Guys,
Just following up an this and seeing when the bug fix is likely to make it to production. I have implemented the css fix, but would rather have it resolved before I hand over to the client.
Thanks
February 8, 2021 at 10:24 am #1650697TomLead DeveloperLead DeveloperThis fix has been implemented in the next GPP version. We’re trying to get the alpha released this week.
Thanks!
April 22, 2021 at 11:47 pm #1745544MattHi Tom,
Just following up on this. It seems that this issue still persists. Any timeline on a fix? Or more likely just wait until 2.0?
Thanks
-
AuthorPosts
- You must be logged in to reply to this topic.