• Resolved Marco

    (@dapro)


    I’m using a shortcode for a total based on thistopic in the forum. The issue i’m having is that it only returns the first number of the amount. I’ve tried a few different ways of getting it to work but it still will not.

    add_shortcode('total','t_budget');
    function t_budget() {
    	$a = do_shortcode('[gravitywp_count formid="8" number_field="37" decimals="2" dec_point="." thousands_sep=","]');
    	$b = do_shortcode('[gravitywp_count formid="8" number_field="37" decimals="2" dec_point="." thousands_sep=","]');
        $c = $a - $b; 
    	return $c;
           }

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author GravityWP

    (@gravitywp)

    Hi @dapro

    This falls outside our official plugin documentation / support. Did you test if the individual use of our shortcode functions?

    You could try to delete the last three arguments from the shortcode (decimals, dec_point and thousand_sep), since you just want to get the unformatted number to do calculations.

    Also investigate on the numerous PHP and WordPress how to build a shortcode sites to see how you can debug your code yourself. A tip: use var_dump on different places to see if the variables you want to count contain the correct values.

    Good luck and if you get it to work, please share here.

Viewing 1 replies (of 1 total)
  • The topic ‘Calculation Issue Using Shortcode’ is closed to new replies.