如何将CSS类添加到;همتطول;在此php代码中:
add_filter( \'woocommerce_get_price_html\', \'themefars_text_after_price\' );
function themefars_text_after_price($price){
global $post;
$product_id = $post->ID;
$product_array = array( 1204,1202 );//add in the product IDs to add text after price
if ( in_array( $product_id, $product_array )) {
$text_to_add_after_price = \' هر متر طول \'; //change text in bracket to your preferred text
return $price . $text_to_add_after_price;
}else{
return $price;
}
}
最合适的回答,由SO网友:thegirlinthecafe 整理而成
我不确定该html标记允许在何处显示该文本,但可能是这样的:
$text_to_add_after_price = \'<span class="myclass"> هر متر طول </span>\';
将myclass更改为要使用的类。