Site logo

Archived topic

Secondary navigation on mobile question

39 replies · Started by Anonymous on July 10, 2015

Viewing posts 1–15 of 40

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!

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 :)

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

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

Rachel

Hi Rachel,

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

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

culinarytwisted.com

take a look on a mobile device

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.

For mobile?

Absolutely. Go to "Customize > Secondary Navigation > Secondary Navigation > Mobile Label".

What does it mean by "sticky menu"?

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

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?

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');
}

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?

This archived topic is closed to new replies.