简体   繁体   English

为未登录用户删除 Header 和 WooCommerce My-Account 上的页脚

[英]Remove the Header and Footer on WooCommerce My-Account for unlogged users

In WooCommerce, I wanted to simplify the My-Account page by removing the Header and Footer only if the user is not logged in, or if the My-Account page is showing the Login or Register form.在 WooCommerce 中,我想通过删除HeaderFooter来简化My-Account页面,当用户未登录,或者My-Account页面显示Login or Register表单时。

I wanted the users to focus only on the Login or Register form, can it be done using Hook?我希望用户只关注Login or Register表单,可以使用 Hook 完成吗?

Something like;就像是;

function remove_header_footer(){
  if(!is_user_logged_in() && is_page('my-account')){
     //Remove the header and footer
  }
}
add_action('WHAT-ACTION-TO-USE?', 'remove_header_footer');

Find out get_header() and get_footer() in myaccount page.在 myaccount 页面中找出 get_header() 和 get_footer()。 Place those functions inside your conditions.将这些功能放在您的条件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM