• 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

  • The topic ‘Printing Current User Name using PHP’ is closed to new replies.