Using is_user_logged_in()
you can detect the status of the current user. In addition to this you can also call wp_get_current_user()
which will set a global object the the current user information.
1 2 3 4 5 6 7 |
<?php require_once('wp-blog-header.php');?> <?php define('WP_USE_THEME', false); wp_head(); ?> <?php if (is_user_logged_in()): wp_get_current_user(); ?> <p>Welcome, <?=$current_user->user_login ?></p> <?php else: ?> <p>Welcome, visitor</p> <?php endif;?> |