Show Single Variations
Append Trademark After The Product Title
Coming soon: Iconic Show Single Variations is becoming part of Kadence Shop Kit. You may see both names used while we update the product, documentation, and customer experience.
You might want to dynamically add a Trademark symbol or something else after the product or variation title. If that’s the case, the below code snippet can be used to get it done:
/**
* Append TM after the product title
*
* @param string $title
* @param int $id
*
* @return string $title
*/
function iconic_update_post_title( string $title, int $id ): string {
$allowed_post_ids = array( 1, 2, 3 );
if ( in_array( $id, $allowed_post_ids ) ) {
if ( 'product' === get_post_type( $id ) || 'product_variation' === get_post_type( $id ) ) {
return $title . "TM";
}
}
return $title;
}
add_filter('the_title', 'iconic_update_post_title', 10, 2);
Filed under
Uncategorized
Was this page helpful?
Thanks for the feedback!