Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php WooCommerce/WPML-翻译自定义价格消息钩子_Php_Wordpress_Woocommerce_Wpml_Hook Woocommerce - Fatal编程技术网

Php WooCommerce/WPML-翻译自定义价格消息钩子

Php WooCommerce/WPML-翻译自定义价格消息钩子,php,wordpress,woocommerce,wpml,hook-woocommerce,Php,Wordpress,Woocommerce,Wpml,Hook Woocommerce,我在WooCommerce中创建了此函数,它用一些后续文本替换中的当前价格,后跟价格。它工作得很好 但是,我们在WPML中设置了两种不同的语言,但这两种语言都没有显示 如何使用WPML使其可翻译 add_filter( 'woocommerce_get_price_html', 'new_custom_price_message' ); function new_custom_price_message( $price ) { $regular_price = get_post_meta

我在WooCommerce中创建了此函数,它用一些后续文本替换中的当前价格,后跟价格。它工作得很好

但是,我们在WPML中设置了两种不同的语言,但这两种语言都没有显示

如何使用WPML使其可翻译

add_filter( 'woocommerce_get_price_html', 'new_custom_price_message' );
function new_custom_price_message( $price ) {
    $regular_price = get_post_meta( get_the_ID(), '_price', true);
    $s = 100000;
    if ( $regular_price >= $s ) {
        $ss = __('Starting at: Price Upon Request', 'my-theme-slug');
        return $ss;
    }
    else if ($regular_price < $s ){
        $price_text = __('Starting at: ', 'my-theme-slug');
        return $price_text . $price;
   }
}
add_filter('woocommerce_get_price_html','new_custom_price_message');
函数新建\自定义\价格\消息($price){
$regular_price=get_post_meta(get_ID(),'u price',true);
$s=100000;
如果($正常价格>=$s){
$ss=u uuuuuuuuuuuuuuu('Price-on-Request','my-theme-slug');
返回$ss;
}
其他条件(正常价格<$s){
$price_text=uuuu('从:'开始,'我的主题片段');
返回$price_text.$price;
}
}

谢谢。

为什么你会得到这样的价格
$regular\u price=get\u post\u meta(get\u ID(),'u price',true)当您使用过滤器提供时(请参见
函数新建\u自定义\u价格\u消息($price)
中的
$price
)?为什么您会得到这样的价格
$regular\u price=get\u post\u meta(get\u ID(),'u price',true)当过滤器提供时(请参见
函数新建\自定义\价格\消息($price)
中的
$price
)?