Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

graemebryson5 on "Shortcode Query"

$
0
0

Hey,

I'm currently using a shortcode I found to display the username of the current logged in user. Using the currentuserinfo section in the codex, I've attempted multiple variations to have it display the 'firstname' instead. I'm a total novice with php - is this even possible with the current code I have (below)?

add_shortcode( 'current-username' , 'ss_get_current_username' );
function ss_get_current_username(){
    $user = wp_get_current_user();
    return $user->display_name;
}

Any advice would be massively appreciated!


Viewing all articles
Browse latest Browse all 8245

Trending Articles