You know that WooCommerce generates the Shop page automatically, you only need to select what page to use in the settings.
Also, it does not matter what title your page has, it will still use the title “Product – Your site name”.
How to change it?
Add this code at the end of the file functions.php in wp-content/themes/your-child-theme-name/:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Change the Shop archive page title. | |
* @param string $title | |
* @return string | |
*/ | |
function wc_custom_shop_archive_title( $title ) { | |
if ( is_shop() && isset( $title['title'] ) ) { | |
$title['title'] = 'My Title'; | |
} | |
return $title; | |
} | |
add_filter( 'document_title_parts', 'wc_custom_shop_archive_title' ); |
This code will only work on the Shop page and won’t affect any other page in your website.
Leave a Reply