apologies for the noob post. I'm fairly new to working with wordpress and I want to do my own php functions - here I just want to show the logged in user's firstname on the page. Below is what I added to my theme's functions.php:
add_shortcode('show_name', 'generate_content');
function show_name() {
$current_user = wp_get_current_user();
$first_name = $current_user->user_firstname;
return $first_name;
}
and then I added this to the html editor of the page I want yet it doesn't display anything:
<span style="font-family: 'Josefin Sans', sans-serif; font-size: 20px;">Hi <strong><?php echo do_shortcode("[show_name]"); ?></strong>,</span>
I guess my main questions would be if I wrote the function correctly and/or where should I place the shortcode call. I hope someone could help as I plan to do some more advanced functions (such as updating database values by clicking a button).