Qwertzui11
Qwertzui11

Reputation: 75

Custom category page title in Woocommerce

On some Woocommerce category pages I would like to change the default Category Page title to something custom. I dont want to change the original "name" on the backend.

Is there some code that I can use for this in functions.php?

Upvotes: 1

Views: 5313

Answers (1)

LoicTheAztec
LoicTheAztec

Reputation: 253784

The following will allow you to customize the page title on Woocommerce product category pages, for specific product categories:

add_filter( 'woocommerce_page_title', 'customize_woocommerce_page_title', 10, 1 );
function customize_woocommerce_page_title( $page_title) {

    // Custom title for the product category 't-shirts'
    if ( is_product_category('t-shirts') ) {
        $page_title = 'Something';
    }
    // Custom title for the product category 'hoodies'
    elseif ( is_product_category('hoodies') ) {
        $page_title = 'Something else';
    }
    return $page_title;
}

Code goes in function.php file of your active child theme (or active theme). Tested and work.

Upvotes: 2

Related Questions