Do you want to track donations on your WordPress site? Then look no further than the Donation Thermometer plugin…
The plugin’s shortcode is simple to configure, and can be placed on any page or post with the simple shortcode:
[thermometer raised=1762 target=2000 align=right]
Multiple thermometers with different targets/sizes/amounts raised/currency symbols/alt text can also be placed on the same page.
The plugin shortcode has many optional parameters to control thermometer width, height, tick alignment, currency, alt text, the thousands separator, currency symbol position, fill colours, or to include a legend. For example:
[thermometer raised=523 target=1000 width=300 align=left currency=$ alt='Raised £523' trailing=false fill=#D318D6]
Width and height values are interpreted as pixels. The alt text can be toggled off by using ‘alt=off’. Currency can proceed the raised and target values by toggling ‘trailing’ to true or false. Unique thermometer fill colours can be assigned using hex values in the fill or colorramp parameter.
[[orientation=landscape]] parameter can render a horizontal thermometer too:
Custom CSS rules
Editable CSS rules provide further customisable options, allowing the thermometer graphic to seamlessly blend with any site theme.
The Donation Thermometer plugin also supports the use of shortcodes to display text values of the amount raised and the target value. Simply use
[therm_%] on any post or page. See the FAQ for instructions on how to use these in text widgets. The thermometer’s raised value can also update dynamically using other plugin shortcodes. For example:
[thermometer raised='my_shortcode' target=1000]
If you have found this plugin useful then please consider leaving a tip. Just follow the PayPal button below and enter the amount (GBP) you wish to pledge. Or if you are using the Brave browser you can tip BAT by clicking the Rewards icon on the right side of the address bar. Many thanks!
FAQ (support forum)
- Can the thermometer automatically update the raised value?
Yes – shortcodes from other plugins that output values can be entered for the raised parameter in the thermometer shortcode. To implement this simply replace the square brackets with single quotation marks, e.g.
[thermometer raised='sales id="1947"' target=5000]. This raised value will be parsed each time the thermometer is loaded on your post/page.
- The shortcodes don’t work in text widgets
WordPress only enables shortcodes in posts and pages by default. Edit the donations_therm.php file in the plugin folder, and add the following lines:
if (!is_admin()) add_filter('widget_text', 'do_shortcode', 11); (Src:http://hackadelic.com/the-right-way-to-shortcodize-wordpress-widgets).
[therm_t]shortcodes show different values to the thermometers.
Values for these shortcodes are set on the Thermometer settings page. If you want your thermometers to display the same values, remove the ‘raised’ and ‘target’ parameters from the
[thermometer] shortcode, e.g.
[thermometer width=300 align=right].
- Can I display the thermometer as a percentage of a parent container?
Yes – just add the percentage symbol to the shortcode value. For example, width=30%. As before, values can be set for Width OR height only. To display the thermometer using an absolute value, set width=320, NOT width=320px.
- How do I use the title & alt attributes?
This alt parameter option will change the title and alt text attributes of the thermometer image. To toggle off, type alt=off. To enter custom text, type alt=’your custom text’ (include apostrophes). If the option is left out the default text ‘Raised £xxxx towards the £xxxx target.’ will appear.
- Can I remove the currency symbol?
Yes! Select the empty option on the settings page dropdown menu, or enter currency=null in the thermometer shortcode, e.g.
- How do I rotate the thermometer to be horizontal?
The thermometer orientation can be set on the settings page for your whole site, or individually in the thermometer shortcode using the parameter:
[thermometer orientation=landscape]. Raised and target values will also rotate automatically.
- What happens when my raised total exceeds the target?
Once this happens the thermometer will completely fill. The shortcode parameter
[thermometer swapvalues=true] can also be used to swap the target and raised value locations, thus allowing you to show how far above your target your current raised total stands.
- How do I change the colour fill of the thermometer?
There are two options for filling the thermometer: with a uniform colour (the default) or with a colour gradient. Either method can be set from the plugin’s settings page or via the shortcode parameters. A uniform fill can be set in the shortcode using
[thermometer fill=#d7191c filltype=uniform]. Drawing a gradient fill requires the additional fill2 parameter:
[thermometer filltype=gradient fill2=#eb7e80].