A Small Tip

Discussion in 'ClassiCraft WordPress Theme' started by amaconline, Jul 18, 2013.

  1. amaconline

    amaconline Member

    Joined:
    Feb 17, 2013
    Messages:
    217
    Likes Received:
    6
    Hi, currently logged-in username does not appear on the top to say who is logged in. However, I have managed to code it round to show which user is logged in on top of the page. See screen below:

    If you want to know how I have done it then let me know.

    Thank you.
     

    Attached Files:

  2. sooraj

    sooraj Member

    Joined:
    Jun 10, 2013
    Messages:
    181
    Likes Received:
    1
    Location:
    India
    Sir
    i want to do this pls help thanks
     
  3. amaconline

    amaconline Member

    Joined:
    Feb 17, 2013
    Messages:
    217
    Likes Received:
    6
    1. On your Wordpress dashboard go to Appearance à Editor
    2. On the Edit Themes select “Header.php” from the “Templates
    3. Scroll down until you see the <body> tag
    4. Under the <body> tag look for the line: <?php if (is_user_logged_in()): ?> and paste the following code under it:

    <?php
    global $current_user;
    if ( isset($current_user) ) {
    echo $current_user->user_login;
    }
    ?>


    Save it and you are all done.​
     
  4. calvinhon

    calvinhon Member

    Joined:
    Apr 1, 2013
    Messages:
    105
    Likes Received:
    3
    Hi,

    But make sure you change your URL link to your Domain URL and not copy amaconline exactly. For example, instead of using this:

    <img src="http://www.easternglobe.com/wp-content/themes/classicrafttheme/images/dashboard-icon.png">
    <?php
    global $current_user;
    if ( isset($current_user) ) {
    echo $current_user->user_login;
    }
    ?>
    Make sure your URL Domain name is being replaced like this:
    <img src="http://www.xxxxxx.com/wp-content/themes/classicrafttheme/images/dashboard-icon.png">
    <?php
    global $current_user;
    if ( isset($current_user) ) {
    echo $current_user->user_login;
    }
    ?>
    Just to make it clearer from what i've said, my URL Domain is www.isniffy.com, right, so it should be like this:
    <img src="http://www.isniffy.com/wp-content/themes/classicrafttheme/images/dashboard-icon.png">
    <?php
    global $current_user;
    if ( isset($current_user) ) {
    echo $current_user->user_login;
    }
    ?>
    Hope this helps!
     
  5. dailypaymentjobs

    dailypaymentjobs New Member

    Joined:
    May 15, 2013
    Messages:
    19
    Likes Received:
    0
    Hello friends,

    I have tried.. but its not been changed..
     

Share This Page