Forum Replies Created

Viewing 15 replies - 16 through 30 (of 128 total)
  • Plugin Author rhewlif

    (@henryp)

    Thanks for letting me know. The latest (2.1.6) update will fix this. Cheers.

    Plugin Author rhewlif

    (@henryp)

    FYI version 2.1.5 now has an editable class for the entire svg

    Plugin Author rhewlif

    (@henryp)

    Thanks!

    It depends what that shortcode from woo donations outputs. If it’s just a number then it should work. If the thermometer doesn’t recognise the output then it will display the default 0 value.

    In the latest plugin update 2.1.5 I have improved on the parsing of external shortcodes so that even if their output includes currency symbols then the thermometer should recognise the value to use. Perhaps try with the new update. If that doesn’t work then it would be useful to know what the woo donations shortcode outputs by itself.

    Plugin Author rhewlif

    (@henryp)

    Thanks!

    No, there’s no option to add a classname to the svg, but that could be a good thing to add in the next update. Depending what you want to do, you could wrap the shortcode in a div element and assign a class to that instead?

    Have you tried the shortcode parameter [thermometer align=center]?

    Plugin Author rhewlif

    (@henryp)

    For a dynamic raised value this thermometer plugin is able to parse any shortcode that outputs a number. The number of compatible plugins is therefore probably fairly large.

    Plugin Author rhewlif

    (@henryp)

    The height/width shortcode parameters switch if the thermometer is in landscape mode. You can therefore use [thermometer orientation=landscape width=100%] to get the full width effect you desire. This will probably be a better, responsive option than defining using pixels as the thermometer width will then match to the page/screen size.

    Plugin Author rhewlif

    (@henryp)

    Ah ok, sorry to hear that. The last update did affect the thermometer fill graphic so maybe something is awry, but its not something I’ve seen elsewhere yet. Could you provide the shortcode you use so I can try to replicate this issue? An example would be also good to see – the link you provided gives a 403 error.
    cheers

    Plugin Author rhewlif

    (@henryp)

    Thanks for bringing this up. I see there is a rogue comma near the beginning of line 371 in the file therm_svg.php which, if removed, will fix this issue. Unless you’ve noticed differently, its only on landscape thermometers where the background shows as black? You can easily remove this comma with the plugin editor until I push a plugin update shortly.

    Plugin Author rhewlif

    (@henryp)

    The svg shape is hardcoded in the therm_svg.php file so it would mean removing/adjusting coordinates here for the fill/border etc. If it’s just to square off the ‘bulb’ part then this is probably relatively simple to do.

    Plugin Author rhewlif

    (@henryp)

    The thermometer accepts shortcodes to dynamically adjust the raised totals (see the FAQ), so I think you could write your own function to create a custom shortcode that pulls in data from a database/form.. like these templates: https://generatewp.com/shortcodes/

    Plugin Author rhewlif

    (@henryp)

    It’s possible in theory with some manual editing of the plugin, but it seems a bit convoluted. Can you not use the original dynamic shortcode in the text field instead of [therm_r]?

    Nevertheless, you can save a shortcode in the settings page, then get the [thermometer] shortcode to parse it by amending around line 120 of therm_shortcode.php with something like this:

    //raised value
    if ($atts['raised'] == '' && !empty($options['raised_string'])){
    	if (!is_numeric(str_replace(",", ".",  $options['raised_string'])) && (strpos( $options['raised_string'], ';') === false) && !is_numeric(str_replace(',','', $options['raised_string']))) {
    		$shortcode = strval($options['raised_string']);
    		$thermProperties['raised'] = do_shortcode( $shortcode);
    	}
    	else{
    	    $thermProperties['raised'] = $options['raised_string'];
    	}
    }
    else{
    // if shortcode present
    	if (!is_numeric(str_replace(",", ".", $atts['raised'])) && (strpos($atts['raised'], ';') === false) && !is_numeric(str_replace(',','',$atts['raised']))) {
    		$shortcode = "[".strval($atts['raised'])."]";
    		$atts['raised'] = do_shortcode( $shortcode);
    	}
            $thermProperties['raised'] = strval($atts['raised']);
    }

    You will also need to amend the therm_raised() function at the bottom of the same file since you now want the [therm_r] shortcode to parse this saved shortcode too. Inserting something like this should work:

    if (!is_numeric(str_replace(",", ".",  $options['raised_string'])) && (strpos( $options['raised_string'], ';') === false) && !is_numeric(str_replace(',','', $options['raised_string']))) {
    	$shortcode = strval($options['raised_string']);
    	$raisedA = array(do_shortcode( $shortcode));
    }
    else{
            $raisedA = explode(';',$options['raised_string']);
    }
    • This reply was modified 2 years, 2 months ago by rhewlif.
    Plugin Author rhewlif

    (@henryp)

    Thanks for the heads up. v2.1.2 should now fix this error. Let me know if it persists though.
    cheers

    Plugin Author rhewlif

    (@henryp)

    I’ve just pushed version 2.1.1 which should help with this issue. Just use the new parameter ‘decsep’

    Plugin Author rhewlif

    (@henryp)

    The tooltip can be disabled by adding the parameter alt=off to the shortcode.

    • This reply was modified 2 years, 6 months ago by rhewlif.
    Plugin Author rhewlif

    (@henryp)

    Hi,
    I think the problem is I have not taken into account the use of commas for a decimal point when parsing a shortcode, which is adding to the confusion.

    Since you seem comfortable to change the plugin code, then to fix this quickly you can change line 121 in therm_shortcode.php to
    $thermProperties['raised'] = str_replace(',', '.', str_replace('.', '', strval($atts['raised'])));

    and line 57 in therm_svg.php to:
    $raisedValue = ($thermProperties['trailing'] == 'true') ? number_format($raisedTotal,$decimals,',',$thermProperties['sep']).$currency : $currency.number_format($raisedTotal,$decimals,',',$thermProperties['sep']);

    I am also presuming on the settings page or in the thermometer shortcode you also have set the parameters sep=. and decimals=2.

    I’ll prioritise this fix more permanently for the next plugin update.
    Cheers

Viewing 15 replies - 16 through 30 (of 128 total)