woocommerce:显示没有帐户信息的登录/注册表单 [英] woocommerce: Show login / register form without account information
本文介绍了woocommerce:显示没有帐户信息的登录/注册表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想显示woocommerce登录和注册页面,但用户登录时没有选项。
在以前的版本中,您可以使用简码,但现在您必须使用[my_account]。当用户登录时,他会看到他的帐户信息。
是否有任何钩子/函数来显示注册和登录表单?
感谢
Maddin
解决方案
我知道,问题稍微老了一些...
试试这个:
add_shortcode('woo-login','my_login');
函数my_login(){
if(is_user_logged_in()){
//做你想做的事...
} else {
ob_start( );
echo'< div class =woocommerce>';
wc_get_template('myaccount / form-login.php');
echo'< / div>';
return ob_get_clean();
}
}
I want to show the woocommerce login and register page but without the options when an user is logged in.
In former versions you could use a shortcode but now you have to use [my_account]. When an user is logged in, he sees his account information.
Are there any hooks / functions to show the register and login forms?
Thanks Maddin
解决方案
i know, the question is a little bit older...
Try this:
add_shortcode('woo-login', 'my_login');
function my_login() {
if (is_user_logged_in()) {
// Do what you want...
} else {
ob_start();
echo '<div class="woocommerce">';
wc_get_template('myaccount/form-login.php');
echo '</div>';
return ob_get_clean();
}
}
这篇关于woocommerce:显示没有帐户信息的登录/注册表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文