WooCommerce StoreFront child theme - How to remove title on homepage

六月ゝ 毕业季﹏ 提交于 2019-12-23 03:11:44

问题


Do you know any hook or filter to remove the title on the frontpage of StoreFront theme?

I try several solutions but nothing works. I use a theme child of Storefront (Stationery by Woothemes).

Thanks for your help.


回答1:


Try adding this code to functions.php:

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

This should remove everything between (and including):

<header class="entry-header">
    <?php
        storefront_post_thumbnail( 'full' );
        the_title( '<h1 class="entry-title">', '</h1>' );
    ?>
</header><!-- .entry-header -->



回答2:


I googled for more details. Please try this

if ( is_page('page id') )
{
      add_filter( 'the_title', '__return_false' );
}



回答3:


I was trying all examples here and in other posts and it worked after to run the remove_action inside the init hook, like this:

function wc_hide_page_title() {
    remove_action( 'storefront_page', 'storefront_page_header' );
}
add_action( 'init', 'wc_hide_page_title');


来源:https://stackoverflow.com/questions/38770814/woocommerce-storefront-child-theme-how-to-remove-title-on-homepage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!