WordPress.org

Ready to get started?Download WordPress

Forums

Printing Current User Name using PHP (1 post)

  1. Trimmode
    Member
    Posted 5 years ago #

    I gave it my best try all day today to get this php code to print out the current user's name at the top of my blog ~ very similar to the top line in the dashboard (Howdy, [User Name] | Profile | Log out).

    I was able to get it to print out everything EXCEPT the name of the current user (It just prints "Howdy " but no name. Also it doesn't recognize my class that I am trying to add to the dividing "|"'s. I just want to make them a different color using a class.

    <span class="login_container">
    	         <?php global $user_ID;
                            if ($user_ID) {
                                echo "Howdy "; echo $user_identity; echo '<class="login_light">' . " | ";
                                } 
    
                            wp_register('<class="login">'); {echo " | ";}
    
    						if($user_ID) {
    							echo '<class="login"><a href="' . site_url('wp-login.php?action=logout', 'login') . '">' . __('Log Out', 'atahualpa') . '</a>';
    						} else {
    							echo '<class="login"><a href="' . site_url('wp-login.php', 'login') . '">' . __('Log In', 'atahualpa') . '</a>';
    						}
    		    ?>
    
    	    </span>

    Any help would be much appreciated. Thank you.
    Trimmode

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.