[Resolved] How to disable entire site header on mobile (pages & posts)

Home Forums Support [Resolved] How to disable entire site header on mobile (pages & posts)

Home Forums Support How to disable entire site header on mobile (pages & posts)

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #2384096
    Laura

    I am trying to hide the entire site navigation (logo and menu) for pages and posts on mobile.
    https://idealcrm.app/
    Current settings

    • Mobile Menu – off
    • Use Navigation as Header – not checked

    I tried all of these in Additional CSS and none work

    @media
    (max-width: 768px) {
    body.single #mobile-header {
    display:none !important;
    }

    body.page #mobile-header {
    display:none !important;
    }
    }

    @media
    (max-width: 768px) {
    body.single nav#main-navigation {
    display:none !important;
    }

    body.page nav#main-navigation {
    display:none !important;
    }
    }

    @media
    (max-width: 768px) {
    body.single #site-nav {
    display:none !important;
    }

    body.page #site-nav {
    display:none !important;
    }
    }

    I’ve tried this function in functions.php and it doesn’t work

    add_action( ‘wp’, function() {
    $disable_nav = get_post_meta( get_the_ID(), ‘_generate-disable-nav’, true );

    if ( $disable_nav ) {
    remove_action( ‘generate_after_header’, ‘generate_menu_plus_mobile_header’, 5 );
    }
    }, 100 );

    #2384152
    David
    Staff
    Customer Support

    Hi there,

    try this CSS:

    
    @media(max-width: 768px) {
        body:is(.single, .page) #masthead {
            display:none !important;
        }
    }
    #2384494
    Laura

    Thank you so much for the quick reply!
    Unfortunately that didn’t work either.
    It removed the header only from the front page.
    The rest of the pages and all posts still have it.
    Is there anything else I can supply to makes this process easier? (credentials, screenshots of settings,…)

    #2384507
    David
    Staff
    Customer Support

    Where did you add the CSS?

    #2384512
    Laura

    In the Additional CSS

    #2384518
    David
    Staff
    Customer Support

    I can see it working on the home page…. but not the single posts.
    Can you clear any plugin caches you have in place ?

    #2384553
    Laura

    It worked after I cleared cache. Thanks again for the prompt replies! This was very helpful.

    #2385115
    David
    Staff
    Customer Support

    You’re welcome!

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