When a user is not logged in I am trying to show
Support || Log In
When they are logged out it should say
Support || Log Out
<
Your code has a syntax error:
<li><?php else if (!is_user_logged_in() ) { echo " <a href="http://example.com/wp-login.php" title=\"Logout\">Member Login</a>";}?></li>
You should escape the double-quotes:
<li><?php else if (!is_user_logged_in() ) { echo " <a href=\"http://example.com/wp-login.php\" title=\"Logout\">Member Login</a>";}?></li>
Use this code:
<div class="fr">
<ul class="rss">
<li><a href="http://example.com/wp-login.php">Support</a></li>
<li>
<?php if (is_user_logged_in() ): ?>
<a href="<?php echo wp_logout_url() ?>" title="Logout">Logout</a>
<?php else: ?>
<a href="http://example.com/wp-login.php" title="Logout">Member Login</a>
<?php endif ?>
</li>
</ul>
</div>
Your mistake is that you should not insert anything between closing }
and else
keyword. Also, in templates, oldschool if
, while
, foreach
form should be used - see above.