默认情况下,WooCommerce产品详情页底部的Related Products这个标题名称没有专门的地方进行修改,那么我就需要用到老方法,在当前主题下的functions.php文件末尾,直接添加如下代码进行定义:
1 2 3 4 5 6 7 8 9 10 11 |
// Change Related products text strings function custom_related_products_text( $translated_text, $text, $domain ) { switch ( $translated_text ) { case 'Related products' : $translated_text = __( 'Other Items You Might Like', 'woocommerce' ); break; } return $translated_text; } add_filter( 'gettext', 'custom_related_products_text', 20, 3 ); |
调整完之后的Related Products的显示效果如下