Created
January 29, 2013 21:28
-
-
Save intelliweb/4668057 to your computer and use it in GitHub Desktop.
Custom shortcode to display user meta for currently logged in user
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
<?php | |
// Custom shortcode to display user meta for currently logged in user | |
add_shortcode('intw_user_meta', 'intw_user_meta_func'); | |
function intw_user_meta_func($atts) { | |
if ( is_user_logged_in() ) { | |
$current_user = wp_get_current_user(); | |
$content = '<p>Welcome, ' . $current_user->display_name . '!</p>'; | |
return $content; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment