I have this function (woocommerce) and it changes the product descriptions tab titles from the defaukt....

add_filter( 'woocommerce_product_tabs', 'wc_change_product_description_tab_title', 10, 1 );
function wc_change_product_description_tab_title( $tabs ) {
  global $post;
    if ( isset( $tabs['description']['title'] ) )
    $tabs['description']['title'] = '★ Product Information'."\n".' ★ Ingredients'."\n".' ★ Sizes';
    return $tabs;

The problem is, that it does not separate new titlles like this:

★ Product Information
★ Ingredients
★ Sizes

I've tried \n and \r and <br> and char(13) to get them to stack......
But Im running into a dead-end. Is there a way to do this other than ( ."\n". ) ? and even that does not work :(

Recommended Answers

All 3 Replies

It's likely that HTML is being stripped from the description as it is being rendered.
You may need to remove the filter as described here:
Woocommerce docs

Thanks for the input but that didn't work... it just displayed the html as a string (like) <br>

Well here's an update!

  • added a css white-space: pre; /* or pre-wrap */class to the tabs

and the "/n" worked....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.