此代码将站点上英语(En)和泰语(Th)产品的描述标题更改为“Attributes”。但很明显,它只需要为英文版本返回此参数,并为泰国产品返回'คุณลักษณะ‘。
add_filter('woocommerce_product_description_heading','switch_product_description_heading');
function switch_product_description_heading() {
return 'Attributes';
}我尝试这样做,以获取PolyLang的当前语言,但没有效果:
function language_switch() {
if(pll_current_language=='en') {
add_filter( 'woocommerce_product_description_heading', 'switch_product_description_heading' );
function switch_product_description_heading() {
return 'Attributes';
}
} elseif (pll_current_language=='th') {
add_filter( 'woocommerce_product_description_heading', 'switch_product_description_heading' );
function switch_product_description_heading() {
return 'คุณลักษณะ';
}
}
}任何帮助都将不胜感激!
https://stackoverflow.com/questions/47708012
复制相似问题