如何在 WooCommerce 中创建单独的登录和注册页面 [英] How to create separate log-in and registration pages in WooCommerce

查看:54
本文介绍了如何在 WooCommerce 中创建单独的登录和注册页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将woocommerce的登录和注册页面分开.(有一个不同的解决方案,我不能在这里工作:WooCommerce 网站中的单独注册页面)

I want to seperate the login and registration page for woocommerce. (there is a different solution that I don't get to work here: Separate registration page in WooCommerce website)

我复制了 form-login.php 并将其重命名为 register.php在 register.php 模板中,我删除了登录内容.

I duplicated the form-login.php and renamed it to register.php In the register.php template I deleted the login-content.

我想向 wordpress 添加一个页面,并将带有 SHORTCODE 的 register.php 模板添加到该页面.我该怎么做??

I want to add a page to wordpress and add the register.php template with a SHORTCODE to that page. How do I do this??

然后我可以添加一个注册链接到登录页面

Then I could add a Register Link to the Login Page with

<a href="<?php echo get_permalink(put the ID of the registerpage here) ?>"><?php _e( ' Register' ); ?></a>

并加载新的短代码注册页面.嗯嗯……

and the new shortcode register page is loaded. mmmhhh...

我必须在重复登录名/now register.php 中添加什么,才能将其加载到任何带有 SHORTCODE 的页面?那会很有趣.

what do I have to add to the duplicated login /now register.php, that it can be loaded to any page with a SHORTCODE? that would be interesting.

感谢您的帮助!最好的祝福,米卡

Thanks for helping out!Best wishes, Mika

推荐答案

一个更直接的方法是将原始 form-login.php 的内容保存为 form-login-single.php,然后将文件 form-login.php 替换为:

A more straightforward way to do this is to save the contents of the original form-login.php as form-login-single.php, and then replace the file form-login.php with:

<?php
if( isset($_GET['action']) == 'register' ) {
    wc_get_template( 'myaccount/form-register.php' );
} else {
    wc_get_template( 'myaccount/form-login-single.php' );
}

这样你就不需要进一步修改你的 functions.php,而且你不会遇到我在使用 @Hassan 时得到的注册表单的双重渲染的任何问题-阿里的方法.

This way you don't need to modify your functions.php further, plus you don't run into any trouble with double-rendering of the register form that I got when using @Hassan-ALi's method.

这篇关于如何在 WooCommerce 中创建单独的登录和注册页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆