Trying to get login link to display name when logged in
-
I just want to say that I tried searching and nothing worked. No, really. I searched for “wordpress” and nothing came up. I think the search is broken.
Anyway, here’s my situation: I’m trying to get a log in/register link to display on every page. I have code that works, and will let me do this. I basically stripped it down from the code that appears near comments. I also want it to display Logged in as [user]. Log out, when you’re logged in.
It was working. I must have screwed something up, but I have no clue what. Can anyone give me any ideas? Maybe there’s a better way of doing this that I don’t know about.
Here’s my code:
<?php if ( get_option('comment_registration') && !$user_ID ) : ?> <a href="<?php echo get_option('siteurl'); ?>/login">Log in/Register</a> <?php else : ?> Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>">Log out</a> <?php endif; ?>
Thanks!
- The topic ‘Trying to get login link to display name when logged in’ is closed to new replies.