自定义注册模板/页面

时间:2013-04-09 作者:charlenemasters

有没有办法在自定义页面上显示WordPress注册表表单<?php get_search_form( $echo ); ?> 搜索表单?如果没有,人们将如何创建这样一个模板?顺便说一句,我想在没有Ajax的情况下完成这项工作。欢迎您提出任何建议/想法!

2 个回复
最合适的回答,由SO网友:Bainternet 整理而成

以下是我以前使用过的函数:

function registration_form_wpa95139(){
    if (is_user_logged_in()) return;
    ?>
    <div class="Registration">
        <div id="register-form">
            <div class="title">
                <h1><?php _e(\'Register your Account\'); ?></h1>
                <span><?php _e(\'Sign Up with us and Enjoy!\'); ?></span>
            </div>
            <form action="<?php echo site_url(\'wp-login.php?action=register\', \'login_post\') ?>" method="post">
                <input type="text" name="user_login" value="Username" id="user_login" class="input" placeholder="Username" />
                <input type="text" name="user_email" value="E-Mail" id="user_email" class="input"  placeholder="E-Mail" />
                    <?php do_action(\'register_form\'); ?>
                    <input type="submit" value="<?php _e(\'Register\'); ?>" id="register" />
                <hr />
                <p class="statement"><?php _e(\'A password will be e-mailed to you.\'); ?></p>
            </form>
        </div>
    </div><!-- /Registration -->
    ?>
}
你可以这样称呼它:

<?php registration_form_wpa95139() ;?>

SO网友:Sosthenes Kwame Boame

使用此选项可将用户重定向到要求其登录/注册之前查看的页面<?php if (!is_user_logged_in()) auth_redirect(); ?>

在调用页眉之前,请将其放在要设置为私有的页面模板的最顶部(第1行)。如果你有任何问题,请告诉我。

结束

相关推荐

Gravity Forms Post method

我有一个简单的表单,用户将填写该表单,它将成为我网站上的一篇帖子。我有两个问题:我正在使用Post title、Post自定义字段元素(对于单行文本)和Post Body元素(对于段落文本)。但是,当我提交测试表单时,只显示标题,没有显示我在自定义字段元素中编写的数据。有没有设置可以让我的帖子中显示字段标题?(也就是说,Name字段实际上会在帖子上显示“Name:用户键入的任何内容”)当我能够在帖子上显示其中一个正文字段时,它只有我键入的信息,而没有标题。可能我没有正确使用post字段,因此任何方向/意见