X theme - how to include PHP sessions in X theme navigation bar

X theme

So I want to add login links etc to the menu based on if a user is logged in by checking if the $_SESSION[‘username’] variable is set using isset. Where should I include this code?

Hi there,

Thanks for writing in! Regretfully this isn’t a feature offered by X. It could be possible with custom development, but this would be outside the scope of support we can offer. You may wish to consult a developer to assist you with this. X is quite extensible with child themes, so there are plenty of possibilities. Or, use a plugin like Login Logout Menu or Nav Menu Roles

Thanks for understanding. Take care!

Hi. Could you at least tell me where the _navbar.php file is stored? I’m using the X child theme, but I’ve looked in /themes/x/framework/views/global and it’s not there

I’ve got it now:

Paste the following into functions.php

I’ve included it in a pastebin because the formatting is screwing up

Hi there,

Yes, PHP codes should be correctly formatted. I guess it’s okay now :slight_smile:

Thanks!