I'm pretty green when it comes to php...really the only foray into the subject being working with wordpress. Regardless, I have been looking for a way to essentially echo a php statement such as below if, say the user is logged in. The following essentially echoes a logout link in wordpress.
<?php wp_logout_url( home_url());?>
Now, I can't just echo the above because the link needs to be customized, in this case, using an Icon from font awesome. Now, I need to essentially use the above as the HREF for an HTML link. I know after searching this site that echoing a php statement within a php statement is something you shouldn't do. I came up with the following and I'm wondering if there is a more effective method. This works by the way.
<?php if (is_user_logged_in()) {
$Logout = wp_logout_url( home_url());
echo '<a href="' . $Logout . '" id="addnewpost"><i class="fa fa-sign-out"></i></a>';
}
?>
Any advice would be appreciated.