Reputation: 5
If
test.com/shop , title is Products | ABC
so
test.com/shop/i_am_a_product , title is I am a product | ABC
Now , i want change this Title to I am a product | ABCDEF .
How to do ? just add something to title ( Keep index title to ABC ).
Sorry my english , can anyone help me ?
Upvotes: 0
Views: 8730
Reputation: 3830
From your question I'm assuming that you want to modify the page title in the single product's page. To modify the page title open your theme's header.php
file.
I'm assuming the current <title></title>
tag is like following-
<title
<?php wp_title( '|', true, 'right' ); ?>
<?php bloginfo('name')?>
</title>
Woocommerce provides a function is_product()
to check that if the current page is the single product page. Use it as following-
<title
<?php wp_title( '|', true, 'right' ); ?>
<?php
if( is_product() ){
// use your own code here, like ABCDEF
// this part will only show up in a single product page
}
else{
bloginfo('name'); // this is the name of your website.
// use your code to display title in all other pages.
}
</title>
Hope this might be helpful.
Thanks.
Upvotes: 1