2016-07-19 119 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

相關問題