簡體   English   中英

從woocommerce店面主題主頁中刪除頁面標題

[英]Remove page title from woocommerce storefront theme homepage

之前有人問過這個問題,我在這里嘗試了許多解決方案,但沒有一個對我有用。 我已使用woocommerce店面主頁模板將主頁設置為靜態頁面,並希望刪除頁面標題標頭。 我曾嘗試將此代碼添加到我的functions.php中,但沒有執行任何操作,

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

我已經嘗試了以下答案:

如何從WooCommerce店面主題首頁隱藏頁面標題?

WooCommerce StoreFront子主題-如何刪除主頁上的標題

以下代碼有效,但僅適用於商店頁面。 我找不到主頁的條件標簽。

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' );

任何人都可以在不使用插件的情況下幫助我做到這一點。 謝謝!

如果使用店面主頁模板,則需要使用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');

嘗試這個

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

這在發布時起作用:

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' );

嘗試使用以下代碼在首頁或任何特定頁面上隱藏頁面標題

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' );

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM