Login and Logout top right links using wp functions

This commit is contained in:
Silvan Calarco 2014-12-29 16:23:23 +01:00
parent 0bd356ab10
commit baf87075d3

View File

@ -31,12 +31,13 @@ if ( !is_active_sidebar( 'top-widget' )
<?php global $current_user; <?php global $current_user;
echo "<br>"; echo "<br>";
if (!is_user_logged_in()) { if (!is_user_logged_in()) {
echo "<a class='mytoplink' href=".site_url('/login/').">".__('Login')."</a> / "; echo "<a class='mytoplink' href=".wp_login_url( get_permalink() ).">".__('Login')."</a> / ";
echo "<a class='mytoplink' href=".site_url('/register/').">".__('Register')."</a>&nbsp;&nbsp;"; echo "<a class='mytoplink' href=".site_url('/register/').">".__('Register')."</a>&nbsp;&nbsp;";
} else { } else {
get_currentuserinfo(); get_currentuserinfo();
$a = sprintf( __('Howdy, %1$s'), $current_user->display_name ); $a = sprintf( __('Howdy, %1$s'), $current_user->display_name );
echo "<a class='mytoplink' href=".site_url('/forums/users/').$current_user->display_name.">".$a." ".get_avatar( $current_user->ID, 20 )."</a>&nbsp;&nbsp;"; echo "<a class='mytoplink' href=".site_url('/forums/users/').$current_user->display_name.">".$a." ".get_avatar( $current_user->ID, 20 )."</a>&nbsp;&nbsp;";
echo "/ <a class='mytoplink' href=".wp_logout_url( get_permalink() ).">".__('Logout')."</a>&nbsp";
} }
if ( function_exists ('the_msls' ) ) { echo " "; the_msls(); } if ( function_exists ('the_msls' ) ) { echo " "; the_msls(); }
?> ?>