Created
February 2, 2015 11:15
-
-
Save BoweFrankema/decdbae7ee4be82dbc1d to your computer and use it in GitHub Desktop.
BuddyPress Username Shortcode
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 | |
// Output BuddyPress username through a shortcode | |
function cfc_bp_username ( $atts=null, $content=null ) { | |
global $user_ID; | |
if ( is_user_logged_in() ) { | |
return bp_core_get_username( $user_ID ); | |
} else { | |
return ""; | |
} | |
} | |
add_shortcode('cfc_bp_username','cfc_bp_username'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment