Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'the_title', 'shorten_woo_product_title', 10, 2 );
- function shorten_woo_product_title( $title, $id ) {
- if ( ! is_singular( array( 'product' ) ) && get_post_type( $id ) === 'product' ) {
- return wp_trim_words( $title, 4, '...' ); // change last number to the number of words you want
- } else {
- return $title;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement