I'm having an impossible time with finding documentation or a plugin to do what I'd like. I was hoping someone out here might have an idea, since the only results from 4 hours of Googling are for LaTeX or another pluging meant to display math functions, rather than solve them.


  1. I have a form that, on completion, sends the user to a landing page.
  2. On redirect, the form entries are passed using URL variables.
  3. I have a function that displays these variables on the page (listed below) that is working perfectly.
  4. I would like to calculate these variables on my page by using a shortcode.

function URLParam( $atts ) {
extract( shortcode_atts( array(
'param' => 'param',
), $atts ) );
return $_GET[$param];

add_shortcode('URLParam', 'URLParam');

The intended functionality is to use something like [math] 6 * 6 [/math] in order to output 36.

Usage Example:

URL: domain.com/results/&orders=128&rev=3800

In the (Swift Pagebuilder) Text Block, I'd like to be able to write:
According to this data, your average order value is $[math round='2'] [URLParam param='rev']/[URLParam param='orders'][/math]

The output would read:

According to this data, your average order value is $29.69

The only other option I can see is to create a custom GF that has hidden number fields that populate using the URL params. Then, create a calculation field that is also hidden, and call THAT :value to my text.

This is, obviously, less than ideal, so any help would be greatly appreciated!

Thank you, in advance!

1 Answer 1


In your case, because you call [URLParam] twice, you need to store this data in session, because every call of your shortcode is isolated. If number of params is fixed (param1, param2 and operation, for example) better use it in single shortcode. Actually, there is a lot of variations, how to solve this.

You can use any conditions in shortcode params. For example

[math params='var1,var2,cond-sum']

And, after extraction, convert it to var1 + var2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.