I'm using custom menu for login/logout
here below is my code:
<?php
if(is_user_logged_in()) {
$user = wp_get_current_user();
echo 'Welcome <strong><a href="http://gopalbonline.com/kolkataonwheels/wp-admin/index.php" >'.$user->user_firstname.'</a></strong>
| <a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout</a>';
} else { ?>
<strong><?php wp_loginout(); ?></strong>
or <a href="<?php bloginfo('url') ?>/wp-login.php?action=register"> <strong>Register</strong></a>
<?php } ?>
but problem is :
- redirect to 404 page not current page...
- I want to add user gavatar if he/she logged in
Any help greatly appreciated.
get_permalink()
without the post ID will only work inside the Loop.