跳到内容

Calculate Values with Shortcodes

v2.3

bhagwad · 2018年5月25日 上架

Allows you to display calculated values in your posts and pages. You can even use dynamic shortcodes as variables!

正在使用
200+
评分
4.8 / 5
累计下载
4,824
最近更新
2020年5月20日
9 条评价需要 WordPress 4.0+已测试到 5.4.26PHP 5.2.4+

贡献者

截图

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

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:

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.

Plums

按场景查找 WordPress 插件。安装量、评分和兼容版本来自官方目录。

导航

说明

WordPress 是 WordPress Foundation 的商标。本站与 WordPress Foundation、Automattic 没有隶属关系。这里不托管插件文件,下载和安装以 WordPress.org 上的页面为准。

© 2026 Plums