Title: Calculate Values with Shortcodes
Author: bhagwad
Published: <strong>మే 25, 2018</strong>
Last modified: మే 20, 2020

---

Search plugins

This plugin **hasn’t been tested with the latest 3 major releases of WordPress**.
It may no longer be maintained or supported and may have compatibility issues when
used with more recent versions of WordPress.

![](https://s.w.org/plugins/geopattern-icon/calculate-values-with-shortcodes.svg)

# Calculate Values with Shortcodes

 By [bhagwad](https://profiles.wordpress.org/bhagwad/)

[Download](https://downloads.wordpress.org/plugin/calculate-values-with-shortcodes.zip)

 * [Details](https://te.wordpress.org/plugins/calculate-values-with-shortcodes/#description)
 * [Reviews](https://te.wordpress.org/plugins/calculate-values-with-shortcodes/#reviews)
 *  [Installation](https://te.wordpress.org/plugins/calculate-values-with-shortcodes/#installation)
 * [Development](https://te.wordpress.org/plugins/calculate-values-with-shortcodes/#developers)

 [Support](https://wordpress.org/support/plugin/calculate-values-with-shortcodes/)

## Description

Have you ever wanted to calculate some values dynamically to display in your posts?
Let’s say you have some shortcodes that retrieve values in real time from the database.
Now you want to perform some calculations on those shortcodes and display the results
in your posts or pages. This plugin allows you to use a simple [calculate] shortcode
with the expression inside to display these values in real time!

So an expression like [calculate]2+3*4[/calculate] will return the value “14”. Now
just replace any numeric value with a shortcode that returns a number and you’re
set.

### Attributes

You can use the “dec” attribute to specify the number of decimal digits you want
to round the result up to. The default is “0”. Meaning that by default, all results
will be rounded to an integer.

For international number formatting, you can use the “int” attribute to specify 
a locale. For example, int=”fr_FR” will format the numbers according to the french
locale!

See screenshots for illustrations.

For example, you can use this to display values in a table that are constantly changing.
Or refer to dynamic prices multiplied by some value. The possibilities are endless.

You can see a real world example of this plugin at work [here:](https://www.wp-tweaks.com/how-to-calculate-values-in-wordpress-posts-and-pages/)

The best part is, it doesn’t use dangerous functions like “eval” to work – which
means all authors can use it safely. There’s no danger of it breaking your site.

## Screenshots

[⌊Basic Shortcode Usage in Editor⌉⌊Basic Shortcode Usage in Editor⌉[

Basic Shortcode Usage in Editor

[⌊Calculated value in the post⌉⌊Calculated value in the post⌉[

Calculated value in the post

[⌊Shortcode usage with shortcodes inside⌉⌊Shortcode usage with shortcodes inside⌉[

Shortcode usage with shortcodes inside

## Installation

 1. You can install the plugin from WordPress’s plugin repository.
 2. Just click “Activate” to enable the shortcode.
 3. Or download the zipped file
 4. Then go to Plugins -> Add New
 5. Click “Upload Plugin” at the top of the screen
 6. Use “Choose File” , select the zip file you just downloaded, and click “Install
    Now”
 7. On the next screen, click “Activate”

## FAQ

 1. What math expressions can I use with this plugin?
     This plugin supports all expressions
    allowed by EvalMath. You can see the documentation on this git page: https://github.
    com/dbojdo/eval-math

## Reviews

![](https://secure.gravatar.com/avatar/ed1f95e0717655dd585b1762a61b484b9991dd431ec0cf37125187dd169e3f77?
s=60&d=retro&r=g)

### 󠀁[Great little tool for inline calculations](https://wordpress.org/support/topic/great-little-tool-for-inline-calculations/)󠁿

 [cheekycreative](https://profiles.wordpress.org/cheekycreative/) జనవరి 21, 2022

Used this for a few years now and was just perfect for a few situations where I 
could do calculations to variables within headlines, text and other drag and drop
elements. I could pull in dynamic woo product prices and calculate it with another
variable fees within custom store pages. Non computer person could just update the
woo product base price and everything would display correctly everywhere. Starting
having a few issues in the last year, think about the same time I upgraded to php8.
Issue was it was dropping the last digit in the decimals on rounding if it ended
in 0 regardless of the dec= attribute setting. ie) 3.99 displays fine but 3.90 would
come out as 3.9. I came up with a fix for it though to force the second decimal.
Will post it in the support discussion.

![](https://secure.gravatar.com/avatar/33ad53a58ffd5bc1ee2657ff863153032c6d16b670eaa930e3a550e4b256168b?
s=60&d=retro&r=g)

### 󠀁[Thank You!](https://wordpress.org/support/topic/thank-you-2615/)󠁿

 [phomar](https://profiles.wordpress.org/phomar/) డిసెంబర్ 2, 2020

Thank You so much!

![](https://secure.gravatar.com/avatar/127b005f8a1bda0b22f1b00322a6a7a8c55361b827933c04df954ca516ecd12a?
s=60&d=retro&r=g)

### 󠀁[Fantastic plugin!!](https://wordpress.org/support/topic/fantastic-plugin-1408/)󠁿

 [ukbestrong](https://profiles.wordpress.org/ukbestrong/) ఆగస్ట్ 26, 2020

Great support, works flawlessly and really helped us out with some complex calculations!

![](https://secure.gravatar.com/avatar/5a809fb05ec8fc251ec40ff1e88193b30050b8e456a4e34aa9d037f6d4ab992a?
s=60&d=retro&r=g)

### 󠀁[The plugin is not compatible with Storefront + WooCommerce.](https://wordpress.org/support/topic/the-plugin-is-not-compatible-with-storefront-woocommerce/)󠁿

 [pescianschi](https://profiles.wordpress.org/pescianschi/) నవంబర్ 5, 2019

This plugin kills the normal look in the Storefront theme + WooCommerce. Replacing“
<?” with “<?php” evalmath.class.php solved the problem.

![](https://secure.gravatar.com/avatar/fa6acbc931bc6c104be186a14f8796fb33e9c844f29b4eb55bf7cdb0a1ac9c31?
s=60&d=retro&r=g)

### 󠀁[Great Plugin and Best Support](https://wordpress.org/support/topic/great-plugin-and-best-support-12/)󠁿

 [Forson](https://profiles.wordpress.org/forson/) మే 16, 2019

This plugin does what it says. It enables you to calculate numeric values generated
by shortcodes or numbers within the site. Support is fantastic. When there was a
problem with hidden characters the developer pushed an upgrade out solving the problem
in less than a day!

![](https://secure.gravatar.com/avatar/155e59e96cb405b017b64f8942c246b01a622d7631f73fe16093f0b6148a96ed?
s=60&d=retro&r=g)

### 󠀁[Very easy to use](https://wordpress.org/support/topic/very-easy-to-use-391/)󠁿

 [searchngp](https://profiles.wordpress.org/searchngp/) నవంబర్ 7, 2018

It’s very easy to use and works as described

 [ Read all 9 reviews ](https://wordpress.org/support/plugin/calculate-values-with-shortcodes/reviews/)

## Contributors & Developers

“Calculate Values with Shortcodes” is open source software. The following people
have contributed to this plugin.

Contributors

 *   [ bhagwad ](https://profiles.wordpress.org/bhagwad/)

[Translate “Calculate Values with Shortcodes” into your language.](https://translate.wordpress.org/projects/wp-plugins/calculate-values-with-shortcodes)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/calculate-values-with-shortcodes/),
check out the [SVN repository](https://plugins.svn.wordpress.org/calculate-values-with-shortcodes/),
or subscribe to the [development log](https://plugins.trac.wordpress.org/log/calculate-values-with-shortcodes/)
by [RSS](https://plugins.trac.wordpress.org/log/calculate-values-with-shortcodes/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 2.3

Changed <? to <?php in evalmath.class.php
 Removed the deprecated “money_format”
function and replaced it with NumberFormatter instead

#### 2.2

Strip out HTML from any inside shortcodes

#### 2.1.1

Fixed a potential deprecation error: “Methods with the same name as their class 
will not be constructors in a future version of PHP”

Thanks to Kristina for pointing it out!

#### 2.1

Strip HTML from inside shortcodes

Added a new optional “int” attribute which will format the output in a local currency.
So for example, [calculate int=”fr_FR”]15.00[/calculate] will return 15,00

Fixed a potential deprecation error: “Methods with the same name as their class 
will not be constructors in a future version of PHP”

## Meta

 *  Version **2.3**
 *  Last updated **6 సంవత్సరాలు ago**
 *  Active installations **200+**
 *  WordPress version ** 4.0 or higher **
 *  Tested up to **5.4.19**
 *  PHP version ** 5.2.4 or higher **
 *  Language
 * [English (US)](https://wordpress.org/plugins/calculate-values-with-shortcodes/)
 * Tags
 * [calculated fields](https://te.wordpress.org/plugins/tags/calculated-fields/)
   [evaluation](https://te.wordpress.org/plugins/tags/evaluation/)[shortcodes](https://te.wordpress.org/plugins/tags/shortcodes/)
 *  [Advanced View](https://te.wordpress.org/plugins/calculate-values-with-shortcodes/advanced/)

## Ratings

 4.8 out of 5 stars.

 *  [  8 5-star reviews     ](https://wordpress.org/support/plugin/calculate-values-with-shortcodes/reviews/?filter=5)
 *  [  0 4-star reviews     ](https://wordpress.org/support/plugin/calculate-values-with-shortcodes/reviews/?filter=4)
 *  [  1 3-star review     ](https://wordpress.org/support/plugin/calculate-values-with-shortcodes/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/calculate-values-with-shortcodes/reviews/?filter=2)
 *  [  0 1-star reviews     ](https://wordpress.org/support/plugin/calculate-values-with-shortcodes/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/calculate-values-with-shortcodes/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/calculate-values-with-shortcodes/reviews/)

## Contributors

 *   [ bhagwad ](https://profiles.wordpress.org/bhagwad/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/calculate-values-with-shortcodes/)

## Donate

Would you like to support the advancement of this plugin?

 [ Donate to this plugin ](https://www.wp-tweaks.com)