Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Add a line break in Woocommerce Product Titles

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;
}
Source by php.tutorialink.com #
 
PREVIOUS NEXT
Tagged: #Add #line #break #Woocommerce #Product #Titles
ADD COMMENT
Topic
Name
2+5 =