Created
September 5, 2017 16:28
-
-
Save nathaningram/620e46f3abbe8e878831aad0475529b2 to your computer and use it in GitHub Desktop.
Show Logged In User First Name Shortcode
This file contains 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
// Show Logged In User First Name Shortcode | |
function show_loggedin_function( $atts ) { | |
global $current_user, $user_login; | |
get_currentuserinfo(); | |
add_filter('widget_text', 'do_shortcode'); | |
if ($user_login) | |
return 'Welcome ' . $current_user->first_name . '!'; | |
else | |
return '<a href="' . wp_login_url() . ' ">Login</a>'; | |
} | |
add_shortcode( 'show_loggedin_as', 'show_loggedin_function' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment