0
このコードは、サイトの英語(en)とタイ語(th)製品の説明タイトルを「属性」に変更します。しかし明らかに、これは英語版の場合にのみ返す必要があり、タイ製品の場合は「คุณลักษณะ」を返す必要があります。PolyLangの現在の言語に応じてWooCommerce製品の説明タイトルを切り替える
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 'คุณลักษณะ';
}
}
}
任意の助けをいただければ幸いです!
ハ、それを呼び出す必要がありfunctionです!私の間違い。完璧に今働いている。ありがとう! – Dayley