• I’m working on a theme that will have a login link in the header. So if you’re logged in, it just says logout, but if you’re not logged in, it also displays a register link.

    Below is the simple php switch I’m using to do this. It works fine for logged in users, but for guests, it’s only showing a login link (no register link):

    <div id="login-link" class="masthead-element">
    		<?php
    			if ( is_user_logged_in() ) {
        				echo wp_loginout();
    			} else {
        				echo wp_register(), wp_loginout();
    			}
    			?>
    	</div>

    So I’m guessing that, for whatever reason, it’s not getting to the else part, and all visitors are seeing the first argument. But I can’t find any reason for that to happen.

    I’m running this theme in a multi-site install, on a sub-domain of my main site, if that’s relevant.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Detecting If User Is Logged In’ is closed to new replies.