从woocommerce店面主题主页中删除页面标题

问题描述 投票:0回答:4

之前已经问过这个问题,我在这里尝试了很多解决方案,但没有一个能为我工作。我已经使用woocommerce店面主页模板将主页设置为静态页面,并且想要删除页面标题标题。我已经尝试将此代码添加到我的functions.php中,但它什么也没做,

if ( is_front_page() ) {
   remove_action( 'storefront_page', 'storefront_page_header' );
}

我尝试过以下答案:

How to hide page title from WooCommerce Storefront theme homepage?

&

WooCommerce StoreFront child theme - How to remove title on homepage

以下代码有效,但仅适用于商店页面。我找不到主页的条件标签。

function wc_hide_page_title()
{
    if( !is_shop() ) // is_shop is the conditional tag
        return true;
}
add_filter( 'woocommerce_show_page_title', 'wc_hide_page_title' );

没有人使用插件,任何人都可以帮助我这样做。谢谢!

php wordpress woocommerce
4个回答
0
投票

试试这个

function wc_hide_page_title() {
    if( is_front_page() ) 
        return true;
}
add_filter( 'woocommerce_show_page_title', 'wc_hide_page_title' );

0
投票

这在发布时起作用:

function jasom_dotnet_change_homepage_title( $args ) {
    if(is_front_page()) {
        remove_action( 'storefront_page', 'storefront_page_header', 10 );
    }
}
add_action( 'wp', 'jasom_dotnet_change_homepage_title' );

0
投票

如果您使用的是店面主页模板,则需要使用storefront_homepage操作。

function wc_hide_page_title() {
    if( is_front_page() ) 
    remove_action( 'storefront_homepage', 'storefront_homepage_header', 10 );
}
add_action( 'woocommerce_show_page_title', 'wc_hide_page_title');

-1
投票

请尝试使用以下代码隐藏主页或任何特定页面上的页面标题。

function wc_hide_page_title()
{
    if( !is_page('home') ) // is_page is the conditional tag. 'home' is the page slug or use ID of the page instead of page slug.
    return true;
}
add_filter( 'woocommerce_show_page_title', 'wc_hide_page_title' );
© www.soinside.com 2019 - 2024. All rights reserved.