Price format for number fields

Add to View or Layout:

$[format_money price="[types field='price' output='raw'][/types]"]

Add to custom code/child theme function.php:

//* Shortcode to format the price (add thousands comma separator)add_shortcode('format_money', 'sk_format_money');functionsk_format_money( $atts) {extract( shortcode_atts( array( 'price'=> '0'), $atts) );// $money = number_format( ( float )$price, 2, '.', ',' ); // if you want to show cents$money= number_format( $price);return$money;}

Next PostRead more articles

Leave a Reply