break product title hook
-
Hello,
how to correct this code to let it to make the breaking – insted of | normally the 1st code not working the 2nd yes ,and if i change the symbols to another its working but specific for – no
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/>', $title ); // we replace "-" by "<br>" } return $title; }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/>', $title ); // we replace "-" by "<br>" } return $title; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘break product title hook’ is closed to new replies.