Black Friday sale! Get up to 25% off GP Premium! Learn more ➝

[Support request] Mobile navigation shows up in page header even if navigation is disabled

Home Forums Support [Support request] Mobile navigation shows up in page header even if navigation is disabled

Home Forums Support Mobile navigation shows up in page header even if navigation is disabled

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #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.

    #1108134
    Leo
    Staff
    Customer Support

    Hi 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 πŸ™‚

    #1108278
    wekhter

    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.

    #1108322
    Leo
    Staff
    Customer Support

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

    #1108405
    wekhter

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

    #1108995
    Tom
    Lead Developer
    Lead Developer

    The 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

    #1109090
    wekhter

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

    #1109316
    Tom
    Lead Developer
    Lead Developer

    I 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 πŸ™‚

    #1110127
    wekhter

    @Tom No effect… would the fact that it’s a merged-with-navigation header make any difference?

    #1110345
    Tom
    Lead Developer
    Lead Developer

    It shouldn’t. Can you try increasing the 100 value to something higher maybe?

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.