1,登录和未登录状态
<?php if (is_user_logged_in()) : ?> <?php else : ?> <?php endif; ?>
2,登陆过的账户和登出
<section class="spanthird pull-left"> <h2>Members Login</h2> <?php if (is_user_logged_in()) : ?> <?php global $current_user; get_currentuserinfo(); ?> <span style="color:#fff;display:block;font-family:arial;padding-left:10px;"> Welcome <?php echo ($current_user->display_name); ?><br> <a href="<?php echo wp_logout_url( home_url() ); ?>" title="Logout">Logout</a> </span> <?php else : ?> <form class="form-horizontal" role="form" id="logoform" method="post" action="/wp-login.php"> <div class="form-out"> <label for="inputEmail3" class="col-sm-2 control-label">Username:</label> <div class="col-sm"> <input type="text" class="form-control" name="log" id="user_login"> </div> <div class="clearfix"></div> </div> <div class="form-out"> <label for="inputPassword3" class="col-sm-2 control-label">Password:</label> <div class="col-sm"> <input type="password" class="form-control" name="pwd" id="user_pass"> </div> <div class="clearfix"></div> </div> <div class="form-out"> <div class="col-sm-offset-2 col-sm-10" style="margin-left:63px;"> <button type="submit" class="btn btn-default" value="login">Sign in</button> <input type="hidden" value="<?php _e('/member/'); ?>" name="redirect_to"> <input type="hidden" value="1" name="testcookie"> </div> <div class="clearfix"></div> </div> </form> <?php endif; ?> <?php include'search-form.php'; ?> </section>