Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save MjHead/871d731160a2cdf441c251701b599c8d to your computer and use it in GitHub Desktop.

Select an option

Save MjHead/871d731160a2cdf441c251701b599c8d to your computer and use it in GitHub Desktop.
<?php
add_filter( 'jet-engine/listings/allowed-callbacks', 'jet_add_calc_callback', 10, 2 );
function jet_add_calc_callback( $callbacks ) {
$callbacks['jet_calc_fileds'] = 'Calculated field example';
return $callbacks;
}
function jet_calc_fileds( $field_1_value ) {
return $field_1_value * get_post_meta( get_the_ID(), 'field_2' );
}
@tothld
Copy link

tothld commented Dec 21, 2020

Hi!

How do I format the returned number fomat? I want to change the decimal separator from "." to ",", and need to limit decimals to 2.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment