Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter shelbybark

    (@shelbybark)

    I have made some adjustments to fix this issue. Let me know if you can incorporate the changes:

    `
    diff –git a/index.php b/index.php
    index 81ef7a7..c1ee5c9 100755
    — a/index.php
    +++ b/index.php
    @@ -16,7 +16,7 @@ Author URI: https://maennchen1.de
    load_plugin_textdomain(‘m1mw’, false, basename( dirname( __FILE__ ) ) . ‘/languages’ );

    class Wx {
    – public function getWeather($lat = false, $long = false, $api_key = false) {
    + public function getWeather($lat = false, $long = false, $api_key = false, $temp_fmt = ‘C’) {
    $data = new stdClass();
    if($lat && $long && $api_key) {
    try {
    @@ -35,6 +35,11 @@ class Wx {
    $main = $data->main;
    $data->tempC = round(($main->temp -273.15), 0);
    $data->tempF = round(((($data->tempC * 9 ) / 5) + 32) ,0);
    + if($temp_fmt === ‘F’) {
    + $data->tempP = $data->tempF;
    + } else {
    + $data->tempP = $data->tempC;
    + }
    }

    } catch(Exception $ex) {
    @@ -75,7 +80,7 @@ class m1_miniweather_widget extends WP_Widget
    {
    //renew!
    $m1mw = new Wx();
    – $m1mw_data = $m1mw->getWeather($settings[‘m1mw_lat’], $settings[‘m1mw_long’], $settings[‘m1mw_api_key’]);
    + $m1mw_data = $m1mw->getWeather($settings[‘m1mw_lat’], $settings[‘m1mw_long’], $settings[‘m1mw_api_key’], $settings[‘m1mw_value’]);
    if (!$m1mw_data->error)
    {
    update_option( ‘m1_miniweather_renew_last’, time() );
    @@ -99,7 +104,7 @@ class m1_miniweather_widget extends WP_Widget
    echo $args[‘after_title’];
    if ($m1mw_data->error ===false) {
    echo ‘<div class=”wi wi-owm-‘ . $m1mw_data->weather[0]->id .'” title=”‘ . $m1mw_data->weather[0]->description . ‘” style=”font-size: 2em;’ . $m1mw_fontColor . ‘”>
    – <span class=”m1mw_temp”>’ . $m1mw_data->tempC . ‘°</span>
    + <span class=”m1mw_temp”>’ . $m1mw_data->tempP . ‘°</span>
    </div>’;
    } else {
    echo $m1mw_data->error;

    Thread Starter shelbybark

    (@shelbybark)

    Thanks! Sorry I missed that.

    Thread Starter shelbybark

    (@shelbybark)

    Yes, excellent! The only thing I noticed is that the value doesn’t “stick” after saving. It clears out of the field. Is that the intended functionality? Or should it show in the field after saving the widget?

    Thanks for the help!

    Thread Starter shelbybark

    (@shelbybark)

    Yes, either a setting within each Widget or a general plugin setting.

Viewing 4 replies - 1 through 4 (of 4 total)