Hi,
Sounds feasible – it looks like you would just need to make a small modification to the plugin code to read the raised amount as a shortcode e.g., https://slewis.org/nested-wordpress-shortcodes/
Thanks. I tried changing line 88 in therm_shortcode.php
from:
$thermProperties[‘raised’] = strval($atts[‘raised’]);
to:
$thermProperties[‘raised’] = strval(do_shortcode($atts[‘raised’]));
My shortcode looks like this:
[thermometer raised=[get_total_donations field=”fld_9181836″]]
But it didn’t work. I’ll have to look at it later. Hoping it’s something really simple!
Thanks!
-
This reply was modified 6 years, 7 months ago by
mjtwebsites.
I had the same question fixed it by adding
if (strpos($atts['raised'], '[') !== false) {
$shortcode = strval($atts['raised'])."]";
$atts['raised'] = do_shortcode( $shortcode);
}
to therm_shortcode.php on line 92.
Please add this to the next release
better code:
//raised value
if ($atts['raised'] == '' && !empty($options['raised_string'])){
$thermProperties['raised'] = $options['raised_string'];
}
else{
if (!is_numeric($atts['raised'])) {
$shortcode = "[".strval($atts['raised'])."]";
$atts['raised'] = do_shortcode( $shortcode);
}
$thermProperties['raised'] = strval($atts['raised']);
}
Thanks for this. I will look into this in a bit more detail for the next release.
Hi, this is now incorporated into the latest plugin update, 2.0.8.
This doesn’t seem to work for me. I have a shortcode [total_dons] that returns a donations total and I call your shortcode like this:
[thermometer target=”50000″ raised=[total_dons]]
It shows the thermometer with a 0 raised value and prints the last ] as text on the page.
Do I have to do something special in my shortcode for this to work?
Thanks!
Tried without the target attribute and that doesn’t work either:
[thermometer raised=[total_dons]]
Hi, no as long as it outputs just a number. This should work:
[thermometer raised=’total_dons’]
And it does!! My shortcode does indeed only output a number calculated from the sum of Gravity Forms entries’ totals in several donation forms. It’s a moderately complex shortcode actually but the ouput is not π
I didn’t want the client to have to update this manually. So thank you so much! That really helps.
-
This reply was modified 6 years ago by
pixelyzed.