Title break code
-
Hi,
I’m using the code below to line break product titles, and it works fine on archive pages: https://www.shop.handmadehome.me/product-category/sculptures/
But it doesn’t work in blocks: https://www.shop.handmadehome.me/
Can you please help me to fix the code for blocks?
Thank you!
add_filter( 'the_title', 'custom_product_title', 10, 2 ); function custom_product_title( $title, $post_id ){ $post_type = get_post_field( 'post_type', $post_id, true ); if( in_array( $post_type, array( 'product', 'product_variation') ) ) { $title = str_replace( '–', '<br/><br/>', $title ); // we replace "–" by "<br>" } return $title; }
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Title break code’ is closed to new replies.