Hi there,
I’m using the following code to add a line break in the product titles and it works like a charm almost everywhere except in Ajax search results in which it doesn’t output <br /> properly. Actually it converts the tag <br /> to < br <.
Could you please help me with this problem?
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 ); // we replace '|' by '<br/>':
return $title;
}
Regards
Attachments:
You must be
logged in to view attached files.