- This topic has 9 replies, 3 voices, and was last updated 3 years, 11 months ago by
Tom.
-
AuthorPosts
-
December 18, 2019 at 11:45 am #1108128
wekhter
I have a page header element set up that incorporates the primary navigation (Site header > Merge with content). However on some pages I need the the navigation disabled. So on those pages, I disable that (Disable elements > Top bar, header, primary navigation, secondary navigation all checked).
Viewing the page, it looks correct–the page header is there, but there’s no navigation. However when switching to mobile view, the navigation does show up. If navigation is disabled for a page, then mobile navigation should be disabled as well.
December 18, 2019 at 11:51 am #1108134Leo
StaffCustomer SupportHi there,
Any chance you can link us to the site in question?
You can edit the original topic and use the private URL field.
Let me know π
December 18, 2019 at 3:25 pm #1108278wekhter
Hi, I added a URL to the first post. On this page the top bar/primary navigation/secondary navigation/header are disabled and the header is hidden using CSS, but if you resize the browser down to mobile view the site logo and navigation show up.
Here’s a small test page that shows a page where the header isn’t hidden using CSS: https://fontenddev.com/test/ again, the navigation etc are disabled but when you size the browser down to mobile view the site logo shows up.
December 18, 2019 at 4:42 pm #1108322Leo
StaffCustomer SupportThat’s actually normal behaviour.
So do you actually want the mobile header to show on some pages?
If so we can use some CSS hide it on specific pages.
Just need to make sure that you actually needed mobile header somewhere.
December 18, 2019 at 8:10 pm #1108405wekhter
@Leo Is it normal? The behavior doesn’t follow what I’d expect and is different from how it used to be (as far as I can remember). I’ve used Disable Elements to disable navigation on specific pages before and I was surprised to see that it no longer disables the navigation on mobile.
I’m aware of how to fix it with CSS but it seems like a bug, that’s why I’m reporting it.
December 19, 2019 at 9:42 am #1108995Tom
Lead DeveloperLead DeveloperThe menu itself shouldn’t display, but the Mobile Header does as of GPP 1.9.0.
In GPP 1.10, we’ll be adding a “Mobile Header” option to the Disable Elements list. That way it can completely separate to the navigation/site header.
As a workaround, you can do this: https://generatepress.com/forums/topic/gp-1-9-0-update/#post-1069229
December 19, 2019 at 11:36 am #1109090wekhter
@Tom Thanks, perfect! That makes it so that all the pages that should have nav/header disabled work as they did before.
Just a question, would it possible to use something similar to that to disable the page hero element by watching for
_generate-disable-post-image
the way that snippet watches for_generate-disable-nav
? Our site has a default page hero set up and then disables the hero on specific pages using the exclusion rules in the elements. This makes sense but frustrates editors on the site who expect to be able to disable it the in the edit screen for the individual pages, the same way you can disable navigation etc. I end up having to go in and update the exclusion rules myself whenever this comes up, it would be helpful to be able to disable any default page hero set up on a per-page basis.December 19, 2019 at 6:51 pm #1109316Tom
Lead DeveloperLead DeveloperI don’t see why not, let’s try this:
add_action( 'wp', function() { $disable_page_hero = get_post_meta( get_the_ID(), '_generate-disable-post-image', true ); if ( $disable_page_hero ) { add_filter( 'generate_header_element_display', '__return_false' ); } }, 100 );
Let me know π
December 20, 2019 at 2:50 pm #1110127wekhter
@Tom No effect… would the fact that it’s a merged-with-navigation header make any difference?
December 21, 2019 at 2:07 am #1110345Tom
Lead DeveloperLead DeveloperIt shouldn’t. Can you try increasing the
100
value to something higher maybe? -
AuthorPosts
- You must be logged in to reply to this topic.