2016-07-19 235 views
1

大家好我想从woocommerce产品页面删除页脚。我无法找出页面名称,所以我可以从那里删除wp_footer代码。WooCommerce - 从产品页面删除页脚

我该如何做到这一点?

请指导我。

+1

它不建议从任何页面中删除页脚,因为它可能加载了很多的脚本,样式。 你可以做的是添加条件逻辑到你的footer.php像 'if(!is_product()){加载页脚html}' –

回答

2

您可以使用本机条件语句组合在一起,is_cart()is_checkout()is_account_page(),在footer.php文件的活动主题或子主题的,这样可以隐藏一些元素从尾(用于WooCommerce店页和产品页):

if (!is_cart() || !is_checkout() || !is_account_page()) { 

    // On WooCommerce shop and product pages 

    // here goes CUSTOM displayed footer code for WooCommerce shop and product pages 

} else { // your normal footer code 

    // here goes all displayed footer code 

} 

根据您想从woocommerce页面隐藏什么,你必须把它适应于现有的代码,以费你的需要。 但不删除wp_footer以避免大问题。

参考:Official WooCommerce Conditional Tags


之后,你可以Override WooCommerce Templates via a Theme使用我的帐户模板微调更加WooCommerce行为......

+1

TheAZtec thanx很好的解释... –

1

您可以从WooCommerce产品页面删除页脚 -

if (is_product()) { 
    // here is your footer code which you want to display on woocommerce product page 
} 
else { 
    // past your all footer code here for other pages 
} 

使用此代码在footer.php文件中。

如果您想了解更多,您可以检查这一点 - WooCommerce conditional tags

相关问题