I originally came here to find help on creating a string of text that would display a login link, and when the user was logged in it would should their username. Travis Pflanz had the answer for another user, which works great but I'd like to expand on it further and add a log out link after the user display name when logged in. My PHP experience is extremely low and rely on copy/pasting code. Any help would be greatly appreciated!
The key function to use is
wp_logout_url. This function returns the URL for a user to logout.
You can construct a regular anchor tag / link markup around it and style that as you see fit.
wp_logout_url takes an optional
$redirect argument to send the user to after logout. Here's a sample with markup and the TLD as redirect:
echo '<a class="button" title="Log me out" href="' . wp_logout_url( get_bloginfo('url') ) . ">Logout</a>';