Last active
April 25, 2018 09:59
-
-
Save mrkkr/0cb0116b5d45351f23ba1b01918a5d88 to your computer and use it in GitHub Desktop.
Show user name when is logged in Wordpress #php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function show_username_when_login() { | |
global $current_user; | |
if ( is_user_logged_in() ) { | |
return $current_user->display_name; | |
} else { | |
return 'Log In'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment