Last active
June 20, 2020 15:29
-
-
Save zakirsajib/7d3d9439b335633a16cab8eeb5e82f91 to your computer and use it in GitHub Desktop.
Hide header/Footer in Cart page of Storefront theme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Using Hooks or CSS | |
# Code must go to functions.php of Storefront theme or its child theme | |
function remove_header_from_cart(){ | |
if( is_cart() ):?> | |
<style> | |
header, | |
footer{ | |
display: none; | |
} | |
</style> | |
<?php endif; | |
} | |
add_action('wp_head','remove_header_from_cart'); | |
# Using Hooks | |
function remove_header_from_cart(){ | |
if( is_cart() ){ | |
remove_action( 'storefront_page', 'storefront_page_header', 10 ); | |
remove_action( 'storefront_before_content', 'storefront_header_widget_region', 10 ); | |
remove_action( 'storefront_header', 'storefront_header_container', 0); | |
remove_action( 'storefront_header', 'storefront_skip_links', 5 ); | |
remove_action( 'storefront_header', 'storefront_site_branding', 20 ); | |
remove_action( 'storefront_header', 'storefront_secondary_navigation', 30 ); | |
remove_action( 'storefront_header', 'storefront_product_search', 40 ); | |
remove_action( 'storefront_header', 'storefront_header_container_close', 41 ); | |
remove_action( 'storefront_header', 'storefront_primary_navigation_wrapper', 42 ); | |
remove_action( 'storefront_header', 'storefront_primary_navigation', 50 ); | |
remove_action( 'storefront_header', 'storefront_header_cart', 60 ); | |
remove_action( 'storefront_header', 'storefront_primary_navigation_wrapper_close', 68 ); | |
} | |
} | |
add_action('wp_head','remove_header_from_cart'); | |
function remove_footer_from_cart(){ | |
if( is_cart() ){ | |
remove_action( 'storefront_footer', 'storefront_footer_widgets', 10 ); | |
remove_action( 'storefront_footer', 'storefront_credit', 20 ); | |
} | |
} | |
add_action('wp_head','remove_footer_from_cart'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment