Replacing woocommerce title

I currently have a function that will output my own page title

if(!function_exists('my_woocommerce_shop_page_title' )){
    function my_woocommerce_shop_page_title( ) {
        if ( is_shop()){
            return '<h3 class="page-title">My page</h3>';
        } else{
            return ;
        }
    }
}

add_filter( 'woocommerce_page_title', 'my_woocommerce_shop_page_title');

But this will leave the default <h1> tag (empty) so I’ll have:

Read More
<h1 class="page-title"></h1>
<h3 class="page-title">My page</h3>

I tried with removing the shop page title, but that removes it altogether. How to remove that empty h1 tag?

Related posts

Leave a Reply

1 comment

  1. Unless you are prepared to modify the template, you’ll have to use an alternative solution to remove the empty h1 tag.

    For eg: jQuery("h1.page-title").remove()