Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
672 views
in Technique[技术] by (71.8m points)

wordpress - How to create separate log-in and registration pages in 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)

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

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...

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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' );
}

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...