Created
October 17, 2017 11:38
-
-
Save ahmedeshaan/de4e46cd4bf76b29a84a6378d19ab641 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
add_filter( 'the_title', 'shorten_woo_product_title', 10, 2 ); | |
function shorten_woo_product_title( $title, $id ) { | |
if ( is_shop() && get_post_type( $id ) === 'product' ) { | |
return substr( $title, 0, 15 ); // change last number to the number of characters you want | |
} else { | |
return $title; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment