I have this written in PHP:
<?php global $current_user;
get_currentuserinfo();
?>
<div style="float: right; text-align: right;">
<h4>
<?php
if ( is_user_logged_in() ) {
echo 'Welcome: ' . $current_user->user_login;
?>
</h4>
<p>
<?php
echo '<a>My Classes</a> ¦ <a>Logout</a>';
} else {
?>
</p>
<h4>
<?php
echo 'Welcome, guest!';
?>
</h4>
<p>
<?php
echo '<a>Login</a> | <a>Register</a>';
}
?>
</p>
</div>
And my browser is showing this:
Welcome: Admin
| LogoutMy Classes
Why is that?
By the look of it, you’ve got your
<a>tags floated to the right. That being the case, right floated elements will always stack right to left.What this means is that the first element that is floated to the right will sit on the far right edge, and the second element will float on the right, but sit on the left side of the first element. To fix this, you’ll have to either (a) adjust your CSS so that the
<a>tags don’t float on the right, or (b) re-order your echo statement to output “Logout” before your output “My Classes”.