0

I would like to add a line break in the category Name with " | "

For example, in the Picture that I attached.

The category name is : North American Red Sea Cucumber 北美红参

I want it looks like this: North American Red Sea Cucumber
                                     北美红参
The First line is English and the second line is the translate.

I know it's possible to do a character replacement so that a "|" in the backend becomes a line break
. But I don't know how.

How can I do that?

Woocommerce category Name

I found a useful answer here: Add a line break in Woocommerce Product Titles

Thanks.

  • So is your problem solved now or? If it isn't you should show us what you have tried. – Lara Croft Apr 13 '18 at 07:51
  • Not yet, I need to know WC conditionals tags for category name... – jiankun mao Apr 21 '18 at 08:43
  • I tried this , but did not work....add_filter( 'the_title', 'custom_the_title', 10, 2 ); function custom_the_title( $Name, $post_id ){ $post_type = get_post_field( 'post_type', $post_id, true ); if( $post_type == 'product' || $taxonomy == 'product_cat' ) $Name = str_replace( '|', '
    ', $Name ); // we replace '|' by '
    ': return $Name; }
    – jiankun mao Apr 21 '18 at 08:58

0 Answers0