I have set the “shop” page as my front page and I want to remove the default woocommerce title from the home page of the site.
I have emptied the title but I still get an empty tag like this on the home page:

<h1 class="woocommerce-products-header__title page-title"></h1>

This creates an empty area above the content which is annoying. I have tried the following solutions and they work BUT the title page for category pages would be removed too. I want the title only at the home page be removed.

  1. First solution: I added the following code to my style:

    .woocommerce-page .page-title {
    
     display: none;
    
    }
    
  2. Added the following to function.php

    add_filter('woocommerce_show_page_title', '__return_false');
    

I repeat, these solutions do what they are supposed to but I want the page-title for categories remain and only the title for the home page be removed.

5 s
5

you can overwrite woocommerce template of “archive-product.php” into your current theme and replace with this code.

<?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>

            <?php if(!is_shop()) { ?>
            <h1 class="page-title"><?php woocommerce_page_title(); ?></h1>
            <?php } ?>
<?php endif; ?>

For reference conditional tag of woocommerce

OR

<?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>

                <?php if(is_product_category()) { ?>
                <h1 class="page-title"><?php woocommerce_page_title(); ?></h1>
                <?php } ?>
 <?php endif; ?>

Leave a Reply

Your email address will not be published. Required fields are marked *