XF 2.0 Hide a navtab while maintaining sub navigation?

dehness

Well-known member
Hi,

Since our navigation bar tends to get somewhat cluttered, I would like to remove some navtabs from the primary navigation bar.

However, I would like if the subnavigation menus would remain, if a member were to navigate to the page from another link, for example a forum link.

If I disable the navtab in public navigation that disables all subnav links as well. Is there some way to hide a primary navtab while maintaining sublinks?

Cheers.
 
Rather than disabling the nav, add this to the extra.less template.

This is for the Members tab and the arrow to the right of it - use the browser inspector to determine the id and key for the tab you want to hide.

Less:
[data-nav-id="members"],
[data-xf-key="7"]
{
    display: none;
}
 
I do this on a few sites where I want to clear some space on the nav bar. What I do is add a display condition that will show the tab if it's the active section, but not show the tab if it's not.

For example, this is the display condition for the Media nav item: $xf.visitor.canViewMedia() AND $xf.reply.section == 'xfmg'. So, if "xfmg" is the current section, the Media tab (and sub-nav) will show up. If someone is browsing another part of the site, the forums for example, the Media tab isn't displayed.
 
I do this on a few sites where I want to clear some space on the nav bar. What I do is add a display condition that will show the tab if it's the active section, but not show the tab if it's not.

For example, this is the display condition for the Media nav item: $xf.visitor.canViewMedia() AND $xf.reply.section == 'xfmg'. So, if "xfmg" is the current section, the Media tab (and sub-nav) will show up. If someone is browsing another part of the site, the forums for example, the Media tab isn't displayed.
This is a great method as it can then work with usergroup conditionals, whereas the css method can't :)
 
Top Bottom