问题
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