• Sorry, this must be the dumbest question posted here, but I can’t find a way to put the login or logged in user link in my navigation bar.

    The thing is that I’m not using WordPress menus, I created my own navigation bar.

    What would be the php function to add in my custom, non-wordpress, navigation bar?

    Thanks,

    Enrique

Viewing 1 replies (of 1 total)
  • @eflouret1 – In that case there is no built in function to do what your after it would be a combination of functions.

    I know you said custom nav bar, but why not just make an extra (custom) menu location and output that menu in your custom bar. Then you get the dynamic and easy to manage WP nav functionality, but in your custom locations.

    If not what you want would look like this:

    if (is_user_logged_in()) {
        <a href="<?php echo wp_login_url( get_permalink() ); ?>" title="Login">Login</a>
    } else {
        <a href="<?php echo wp_logout_url( get_permalink() ); ?>">Logout</a>
    }

    For reference all of these are easily findable via google ??

    – wp_login_url (https://codex.www.ads-software.com/Function_Reference/wp_login_url)
    – wp_logout_url (https://codex.www.ads-software.com/Function_Reference/wp_logout_url)

    Hope that helps.

Viewing 1 replies (of 1 total)
  • The topic ‘login/user menus in navigation bar’ is closed to new replies.