• Resolved Florence

    (@floortjahh)


    Hi! I’m fairly new to coding and I’m having trouble combining 2 funtions. Here’s what I’ve got:

    <?php
    if ( is_user_logged_in() ) {
        echo 'Welcome, registered user!';
    } else {
        echo 'Welcome, visitor!';
    };
    ?>

    Instead of “registered user, I’d like it to display the current username.

    This is what I had:

    <?php global $user_identity ;
          get_currentuserinfo();
    
          echo $user_identity ;
    ?>

    I’ve tried several combinations but I can’t seem to figure it out.

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display current username in conditional function’ is closed to new replies.