我正在尝试隐藏购物车、页脚和帐户页面上的Storefront手持页脚栏。我是用Wordpress和Woocommerce编写代码的新手,我编写了以下代码,但什么都不能用。下面是我的3次尝试,我做错了什么?任何帮助都将不胜感激。
add_action('wp_head','noshowHHFCSS');
function noshowHHFCSS() {
echo '<style>
/* Do not show hand held footer bar on cart, check out and account page*/
.page-id-5 .page-id-6 .page-id-7 .storefront-handheld-footer-bar {
display: none!important;
}
</style>';
}
if ( is_cart() || is_checkout() || is_account_page() ) {
echo '<style>
/* Do not show hand held footer bar on cart, check out and account page*/
.storefront-handheld-footer-bar {
display: none!important;
}
</style>';
}
add_action( 'init', 'jk_remove_storefront_handheld_footer_bar' );
if ( is_cart() || is_checkout() || is_account_page() ) {
function jk_remove_storefront_handheld_footer_bar() {
remove_action( 'storefront_footer', 'storefront_handheld_footer_bar', 999 );
}
}发布于 2017-11-25 11:51:29
你可以尝试这样做:在你的根主题文件夹中创建一个名为CSS的新文件夹,如果你还没有这个文件夹的话。之后,创建一个包含页脚样式代码的customFooterStyle.css文件。
在function.php中放置以下代码:
function footerBarStyle() {
wp_enqueue_style( 'custom_footer_css', get_template_directory_uri() . '/css/customFooterStyle.css' );
}
if(is_cart() || is_checkout() || is_account_page() ){
add_action('wp_enqueue_scripts', 'footerBarStyle');
}https://stackoverflow.com/questions/47482005
复制相似问题