Last active
October 6, 2017 11:22
-
-
Save AlKov/9c9b4c46b1c4d416619b0b07febfbfb3 to your computer and use it in GitHub Desktop.
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
// check for function with the same name | |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly | |
if ( ! function_exists( 'alex_vitorials_get_user_unique_name' ) ) { | |
function alex_vitorials_get_user_unique_name(){ | |
if ( ! is_user_logged_in() ) { | |
return; | |
} | |
else { | |
$user = wp_get_current_user(); | |
$avatar = get_avatar( $user->ID, 40 ); | |
$user_nicename = '<span>'; | |
$user_nicename .= get_userdata( $user->ID )->user_nicename; | |
$user_nicename .= '</span>'; | |
return $avatar . $user_nicename; | |
} | |
} | |
add_shortcode( 'user-ID', 'alex_vitorials_get_user_unique_name' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment