joekane
Member
Posted 3 years ago #
Hi all,
I am trying to display the Howdy (Changed to 'Welcome Back')Message on my home page - I am using the code from admin-header.php
<div id="user_info">
<p><?php printf(__('Welcome Back, <a href="%1$s" title="Edit your profile">%2$s</a>'), 'profile.php', $user_identity) ?> |
<a href="<?php echo wp_logout_url() ?>" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a></p>
</div>
It displays the "Welcome Back" but no username - I am signed in as a user?
Do I need to add a call to $user_identity? Would anyone know how to do this.
Thanks, Joe
Try:
<?php if ( is_user_logged_in() ) :
global $current_user;
get_currentuserinfo(); ?>
<div id="user_info">
<p>Welcome Back, <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php" title="Edit your profile"><?php echo $current_user->display_name;?></a> |
<a href="<?php echo wp_logout_url() ?>" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a></p>
</div>
<?php endif;?>
joekane
Member
Posted 3 years ago #
Slightly modified and working perfect
<?php global $current_user; get_currentuserinfo(); echo 'Welcome Back ' . $current_user->user_firstname . "\n";?>
Is there a way to apply a style sheet to the output?
This is outputing perfectly
<a href="<?php echo wp_logout_url() ?>" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a>
See Screenshot
http://joekane.u109.hosting365.ie/screenshot.jpg
Thanks, Joe
joekane
Member
Posted 3 years ago #
Got it working - Thanks for the Help.