I referenced this answer
And from that I used this code on my Wordpress Site
add_filter( 'the_title', 'custom_the_title', 10, 2 );
function custom_the_title( $title, $post_id ){
$post_type = get_post_field( 'post_type', $post_id, true );
if( $post_type == 'product' || $post_type == 'product_variation' ){
$title = str_replace( '|', '<br/>', $title );
}
return $title;
}
However, when I run it the product title line does indeed break but it leaves the
inside of the product title and customers cannot see that.
HTML in Product Title w/ line break
I tried to add this:
< INPUT TYPE="hidden" NAME="
" style="display: none">
To the code snippet but it is not hiding the HTML from the product title. How would I go about inserting the line break and hide the HTML?
` in a tiltle is weird, because it mixes identification with styling, in my opinion. Couldn't you work with a sub-title or modify the container width so the title will break by itself? – Hans Sep 29 '18 at 13:01