Forums

Display Howdy Message on Home Page (4 posts)

  1. 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

  2. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    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;?>
  3. 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

  4. joekane
    Member
    Posted 3 years ago #

    Got it working - Thanks for the Help.

Topic Closed

This topic has been closed to new replies.

About this Topic