cboy
cboy

Reputation: 179

Add span HTML to woocommerce shop title

How can I add a HTML span to the woocommerce shop title? I have this function to change the shop title to menu but I need to add a
and a span. When I add the html I get an error

add_filter( 'woocommerce_page_title', 'woo_shop_page_title');
       function woo_shop_page_title( $page_title ) {
                  if( 'Shop' == $page_title) {
                               return "Menu<br><span id="chinese">家庭晚餐</span>";                         }
        }

Upvotes: 0

Views: 283

Answers (1)

Nathan Dawson
Nathan Dawson

Reputation: 19318

The double quotes used for the ID attribute of the span tag are breaking your string. Either escape them or switch to single quotes.

Single quote example:

return 'Menu<br><span id="...';

Escaping example:

return "Menu<br><span id=\"...";

Documentation: http://php.net/manual/en/language.types.string.php

Upvotes: 1

Related Questions