Created
June 27, 2014 19:18
-
-
Save patrickgilmour/0bf32f8c9bc5070abfab to your computer and use it in GitHub Desktop.
Filter the Title of a WooCommerce Product on the Single Product Page
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
<?php | |
/** | |
* Rename/Filter the Title of a WooCommerce Product on the Single Product Page | |
* | |
*/ | |
add_filter('the_title', 'xcsn_single_product_page_title', 10, 2); | |
function xcsn_single_product_page_title($title, $id) { | |
if( ( is_product() && in_the_loop() ) ) { | |
//Logic for changing the WooCommerce Product Title on a Single Product page goes here | |
return $title; | |
} | |
//Return the normal Title if conditions aren't met | |
return $title; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it is changing all titles ....