You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在WooCommerce产品页与结账页隐藏Elementor粘性页脚?

针对WooCommerce指定页面隐藏Elementor页脚区块的方法

方法一:使用CSS(最简单)

WooCommerce会给不同页面的<body>标签添加专属类名,比如产品页的single-product、结账页的woocommerce-checkout。利用这些类可以精准定位页面,只隐藏目标页的页脚:

/* 替换.elementor-footer为你实际的页脚区块类名 */
.single-product .elementor-footer,
.woocommerce-checkout .elementor-footer {
    display: none !important;
}

确认页脚区块类名的方法:

  1. 打开网站页脚页面,右键点击页脚区域选择「检查」
  2. 在开发者工具的HTML结构里,找到Elementor页脚区块的最外层容器,查看它的class属性(通常包含elementor-section或你自定义的类名)

方法二:通过Elementor模板条件设置(无需写代码)

如果你的页脚是Elementor的主题模板:

  • 进入后台「Elementor > 模板 > 主题模板」
  • 找到你的页脚模板,点击「编辑」
  • 在编辑器左侧的「模板设置」面板中,找到「条件」选项
  • 设置「包含」为「整个网站」,然后添加「排除」规则,选择「产品」和「结账」页面
  • 保存设置即可

方法三:使用PHP代码(适合灵活控制场景)

将以下代码添加到你的主题functions.php文件或自定义代码插件中:

add_action( 'wp_footer', 'hide_footer_on_target_woocommerce_pages' );
function hide_footer_on_target_woocommerce_pages() {
    // 判断当前是否为产品页或结账页
    if ( is_product() || is_checkout() ) {
        ?>
        <style>
            /* 替换为你的页脚区块类名 */
            .elementor-footer {
                display: none !important;
            }
        </style>
        <?php
    }
}

内容的提问来源于stack exchange,提问作者Annihilate

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.18 06:52:07