Secondary navigation on mobile question

Home Forums Support Secondary navigation on mobile question

Viewing 15 posts - 1 through 15 (of 40 total)
  • Author
    Posts
  • #119954
    Sharon

    Hi, I want to have two links across the top of my website even on mobile, so I was thinking the Secondary Navigation addon would be useful but only if I can stop it going into mobile-mode on mobiles. Is there a way to do that? Love this theme so much!

    #120014
    Tom
    Lead Developer
    Lead Developer

    Hi Sharon,

    First, add this function:

    add_action( 'wp_enqueue_scripts', 'generate_dequeue_secondary_nav_mobile', 999 );
    function generate_dequeue_secondary_nav_mobile() {
       wp_dequeue_style( 'generate-secondary-nav-mobile' );
    }

    Adding PHP: http://generatepress.com/knowledgebase/adding-php-functions/

    Then, add this CSS:

    .secondary-navigation .menu-toggle {
          display: none;
    }

    Adding CSS: http://generatepress.com/knowledgebase/adding-css/

    Let me know if that works or not 🙂

    #120070
    Sharon

    Thanks so much for the fast reply. I’ll let you know, am on my phone atm.

    #160181
    Rachel

    I am not comfortable editing the code. The theme should be mobile =
    friendly without the need for that, please advise.

    Rachel

    #160189
    Tom
    Lead Developer
    Lead Developer

    Hi Rachel,

    The theme is mobile friendly, the question here is how to make the secondary navigation not mobile friendly.

    #160191
    Rachel

    To have both nav bars say menu doesn’t look right.

    #160192
    Rachel

    culinarytwisted.com

    take a look on a mobile device

    #160193
    Tom
    Lead Developer
    Lead Developer

    You can change the “Menu” text to whatever you like in “Customize > Secondary Navigation”.

    You can also change the primary menu text if you have Menu Plus.

    #160194
    Rachel

    For mobile?

    #160195
    Tom
    Lead Developer
    Lead Developer

    Absolutely. Go to “Customize > Secondary Navigation > Secondary Navigation > Mobile Label”.

    #160203
    Rachel

    What does it mean by “sticky menu”?

    #160305
    Tom
    Lead Developer
    Lead Developer

    That means the menu will stick to the top of your browser once you scroll past it.

    #212352
    Jessica

    This worked like a CHARM!!!! Thank you for posting.

    Now I am trying to solve this: Conditionally Remove Secondary Nav Menu from all pages EXCEPT the blog.

    I am this far but it’s breaking my site:

    add_action('template_redirect', 'remove_nav_exclude_blog_page');
    function remove_nav_exclude_blog_page() {
    if ( !is_page('blog') ) 
        remove_action('generate_after_header', 'generate_add_secondary_navigation_before_header',);
    }
    

    I have already successfully repositioned the secondary nav into place… just don’t want it showing anywhere except the blog. What am I mucking up?

    #212408
    Tom
    Lead Developer
    Lead Developer

    It might be easier to use CSS:

    .secondary-navigation {
        display: none;
    }
    
    .blog .secondary-navigation {
        display: block;
    }

    Otherwise, something like this might work better:

    add_action('after_setup_theme', 'remove_nav_exclude_blog_page');
    function remove_nav_exclude_blog_page() {
        if ( ! is_home() ) 
            remove_action('generate_after_header', 'generate_add_secondary_navigation_before_header');
    }
    #212412
    Jessica

    The function definitely works but it only removes the secondary nav from the homepage.

    When I tried the CSS method it definitely worked but won’t show the secondary nav on anything BUT the main blog landing page. The individual posts hide it.

    I feel like there’s still another missing piece. Essentially: having the secondary nav show on all blog pages, not just one archive page. I’m digging to find the additional classes for the category archives & individual post archives but I feel like there’s another way to do this with a single function, no?

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