Split Category name with a break
-
Hi,
because i have two languages i just need to split the category name.
an example:
Mensch – Natur – Evolution<br>Human – nature – evolution
but it is not working…I found this code on stackoverflow
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; }
and here is a text
Now you can target different product pages with the WC conditionals tags as is_product(), is_shop(), is_product_category() or is_product_tag() (and many others)
but i have no knwledge of php, can somebody please help
Thanks
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Split Category name with a break’ is closed to new replies.