Title: Calculation Issue Using Shortcode
Last modified: June 27, 2019

---

# Calculation Issue Using Shortcode

 *  Resolved [Marco](https://wordpress.org/support/users/dapro/)
 * (@dapro)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/calculation-issue-using-shortcode/)
 * I’m using a shortcode for a total based on [this](https://wordpress.org/support/topic/count-entries-from-multiple-forms/)
   topic 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](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcalculation-issue-using-shortcode%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Plugin Author [GravityWP](https://wordpress.org/support/users/gravitywp/)
 * (@gravitywp)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/calculation-issue-using-shortcode/#post-11681154)
 * Hi [@dapro](https://wordpress.org/support/users/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.

 * ![](https://ps.w.org/gravitywp-count/assets/icon-256x256.jpg?rev=3215193)
 * [GravityWP - Count](https://wordpress.org/plugins/gravitywp-count/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gravitywp-count/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gravitywp-count/)
 * [Active Topics](https://wordpress.org/support/plugin/gravitywp-count/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gravitywp-count/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gravitywp-count/reviews/)

## Tags

 * [Custom Coding](https://wordpress.org/support/topic-tag/custom-coding/)

 * 1 reply
 * 2 participants
 * Last reply from: [GravityWP](https://wordpress.org/support/users/gravitywp/)
 * Last activity: [6 years, 10 months ago](https://wordpress.org/support/topic/calculation-issue-using-shortcode/#post-11681154)
 * Status: resolved