2013-03-28 84 views
1

我在WordPress侧边栏小部件中有以下内容,它可以充当我的利基在线社区。现在,我可以在用户未登录时显示表单并显示“欢迎来到社区!”用户注销时的消息 - 这很好。但是,登录功能似乎不起作用。我能请你帮忙吗?WordPress登录表单代码

<form name="loginform" id="loginform" action="https://domain.org/wp-login.php"   
method="post"> 
    <p class="login-username"> 
     <label for="user_login">Username</label> 
     <input type="text" name="log" id="user_login" class="input" value="" 
         size="20" /> 
     </p> 
    <p class="login-password"> 
     <label for="user_pass">Password</label> 
     <input type="password" name="pwd" id="user_pass" class="input" 
         value="" size="20" /> 
    </p> 
    <p class="login-submit"> 
     <input type="submit" name="wp-submit" id="wp-submit" class="button- 
         primary" value="Log In" /> 
     <input type="hidden" name="redirect_to" 
         value="https://domain.org/" /> 
     </p> 

    </form> 
<?php } else { ?> 
       <h4>Welcome to the Community!<h4> 
    <?php } ?> 

回答

0

试试这个...

if (!is_user_logged_in()) { 
    wp_login_form(); 
} else { 
    echo '<h4>Welcome to the Community!</h4>'; 
} 

您也可以通过配置阵列wp_login_form()http://codex.wordpress.org/Function_Reference/wp_login_form

+0

感谢@Rob - 我不知道有显示功能登录表单!相反,我编码我自己的简单形式:-)所有的最佳。 – user2209868 2013-03-28 01:40:02

+0

编辑:@Rob,你能帮助我 - 表单没有登录。https://tinyurl.com/crcrohx - (右侧) – user2209868 2013-03-28 02:12:07

+0

它张贴到错误的网址'https:// haiticonnects- patricknommensen.netdna-ssl.com /可湿性粉剂login.php'。检查您的设置。 – Rob 2013-03-28 02:16:00