XF 2.3 How to Remove Nav Bar from Pages?

Matthew H

Active member
I just learned how to set up a page node as a portal homepage. Now I want to hide the nav bar pictured below from unregistered visitors. If there's no such option in the ACP, then how do I do it with CSS inside the pages I've set up to welcome potential new members?

i-want-to-remove-this.webp
 
Last edited:
Solution
@Mr Lucky 's idea hid the Forums and What's New buttons. The link to Latest Activity is the only one left, and I want to hide it as well.
I just tested @Mr Lucky's approach and it does work.

However, I noticed that there are 2 "recent activity" links in the navigation, one of which shows up when no tab is selected. However, a Page will select a a tab by default. So, I'm unsure if this will work (if you have default links).

1732753770387.webp1732753838514.webp

Did you apply it to both of them, and does it still show up?
First, you need to know the node id of the page.

1732707581911.webp

In my case, it's node id 26.

So, I would add this to the template extra.less
CSS:
[data-container-key="node-26"] {
    .p-navSticky {
        display: none;
    }
}

To get this to apply for both logged in and logged out visitors.

1732707661584.webp

If you want it to apply for just logged out visitors:
CSS:
[data-logged-in="false"][data-container-key="node-26"] {
    .p-navSticky {
            display: none;
    }
}
 
I just learned how to set up a page node as a portal homepage. Now I want to hide the nav bar pictured below from unregistered visitors. If there's no such option in the ACP, then how do I do it with CSS inside the pages I've set up to welcome potential new members?
You can hide those individual nav items from unregistered with display condion in the ACP > Public navigation.
FWIW, doing it this way will hide the nav menu buttons from all pages, /forum, /threads, etc., and possibly leave a colored line as the .p-navSticky will still render and might have some padding/space that will show the background color of it.

You stated that you want it gone on just the page you created.

I'd suggest you browse the forum logged out to see that the nav menu is gone everywhere, and if that's what you were going for, then use that method. Otherwise, I'd suggest to implement the extra.less changes above to exclude it on just the portal page that you created.
 
Last edited:
If you want to do it button by button, you'll also need the conditional && $xf.reply.containerKey != "node-26" to only apply it to that page you created. However, this seems more arduous (and redundant) to do as you need to do it for each navigation item, which are many.
 
Perhaps you just wanted the menu buttons gone, but still be able to login/register. In that case:

CSS:
[data-logged-in="false"][data-container-key="node-26"] {
        .p-nav-scroller {
                visibility: hidden;
        }
}

1732713384545.webp

Not quite clear on what you're trying to achieve. So between all this, there are 4 options you can try out to see what works best for you.
 
Try this

$xf.options.enableNewsFeed AND $xf.visitor.user_id
No dice.

Not quite clear on what you're trying to achieve.
I've created a landing page called Guest Lounge. It contains links to three other pages that include info about us, our member perks, and a primer for artists. I want to ensure the only navigation elements that are visible to unregistered users are the Register and Login buttons.

@Mr Lucky 's idea hid the Forums and What's New buttons. The link to Latest Activity is the only one left, and I want to hide it as well.
 
@Mr Lucky 's idea hid the Forums and What's New buttons. The link to Latest Activity is the only one left, and I want to hide it as well.
I just tested @Mr Lucky's approach and it does work.

However, I noticed that there are 2 "recent activity" links in the navigation, one of which shows up when no tab is selected. However, a Page will select a a tab by default. So, I'm unsure if this will work (if you have default links).

1732753770387.webp1732753838514.webp

Did you apply it to both of them, and does it still show up?
 
Solution
I just noticed there's a lightning bolt on the nav bar when viewing my board on a cell phone. Clicking on it displays my site statistics.

Which Public Navigation option do I need to add the visitor_id conditional to in order to hide it from guests?
 
Ah. Right. Just checked again. It displays the What's New page. My forum statistics appear below What's New.

I'm using Russ's Fusion Gamer style. I'll ask him about it on his site.
So that's correct, if you look here the stats are on the what's new page - it's the way it is here on xenForo.com. Not unique to the style.
 
Last edited:
I just noticed there's a lightning bolt on the nav bar when viewing my board on a cell phone. Clicking on it displays my site statistics.

Which Public Navigation option do I need to add the visitor_id conditional to in order to hide it from guests?
An extra.less template edit would do that for the default style. The whatsnew class name might differ on your template. But, it's generally the same concept to hide anything from someone not logged in with LESS.
CSS:
[data-logged-in="false"] {
    .p-navgroup-link--whatsnew {
        display: none;
    }
}
 
Sorry to revive this thread, but it showed up in my search results for Latest Activity.

I'm trying to REMOVE the tab Latest Activity from here per request of a member. I did look at the Public Navigation and I see two instances but they are both NOT enabled. So where else should I look? thanks!


9dd72016c3dbf62282243828bcf04f6f.webp
 
Back
Top Bottom