Plugin này chưa được cập nhật với 3 phiên bản mới nhất của WordPress. Nó có thể không được hỗ trợ và bảo trì, và có thể xung đột với các phiên bản WordPress mới nhất.

Calculate Values with Shortcodes

Mô tả

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.


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:

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.

Ảnh màn hình

  • Basic Shortcode Usage in Editor
  • Calculated value in the post
  • Shortcode usage with shortcodes inside

Cài đặt

  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”

Hỏi đáp

  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:

Đánh giá

21 Tháng Một, 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.
26 Tháng Tám, 2020
Great support, works flawlessly and really helped us out with some complex calculations!
16 Tháng Năm, 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!
Đọc tất cả 9 đánh giá

Người đóng góp & Lập trình viên

“Calculate Values with Shortcodes” là mã nguồn mở. Những người sau đã đóng góp vào plugin này.

Những người đóng góp

Nhật ký thay đổi


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


Strip out HTML from any inside shortcodes


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!


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”