Displaying logged in user name

I’m trying to show the User’s Name in a login button at the top of our page. I tried to base it off of this advice, but it’s just showing the PHP code. Specifically, I’d like “My Account” to change to “Welcome {UserName}.
How do I display logged-in username IF logged-in?

<?php global $current_user; wp_get_current_user(); ?>
<?php if (!is_user_logged_in()) :?>
<a href=”/member-login/” class=”login”>Member Login</a>
<?php else : ?>

<a href=”/account-page/” class=”login”>My Account</a>

<?php endif; ?>
<a href=”/membership/join-sccap-renew-membership/” class=”join”>Join</a>

Read more here:: Displaying logged in user name

Leave a Reply

Your email address will not be published. Required fields are marked *