Support

Account

Home Forums General Issues Change How Numbers Are Displayed Reply To: Change How Numbers Are Displayed

  • Hi All I have a similar problem and have tried the following in a snippet but cant get it to work, for the life of me I can’t find the error ! Any assistance would be appreciated:

    add_shortcode(‘get_product_value’, ‘get_product_value’);

    // function get_product_value($atts){
    // extract(shortcode_atts(array(
    // ‘post_id’ => NULL,
    // ), $atts));
    // if(!isset($atts[0])) return;
    // // $field = esc_attr($atts[0]);
    // $field = product_value;
    // global $post;
    // $post_id = (NULL === $post_id) ? $post->ID : $post_id;
    // $post_value = get_post_meta($post_id, $field, true);
    // $value = number_format($post_value, 2, “.”, “,”);
    // return $value;
    // }
    function get_product_value($atts){
    return “Atts = {$atts[0]}”;
    extract(shortcode_atts(array(
    ‘post_id’ => NULL,
    ), $atts));
    if(!isset($atts[0])) return;
    $field = product_value;
    global $post;
    $post_id = $post->ID : $post_id;
    $post_value = get_post_meta($post_id, $field, true);
    $value = number_format($post_value, 2, “.”, “,”);
    return $value;
    }