Support » Plugin: Weather Underground » Twig error after updating

Viewing 5 replies - 1 through 5 (of 5 total)
  • I am experiencing the same issue. If you are using current for the forecast, the rounding decimal value is not working. If you open up the folder called “templates” then open the file called “current.html” and edit line 27 and remove “|round” this will fix the template error.

    From this:
    <span class="wu-day-current-temp">{{ day.temperature | round }}<sup>&deg;</sup></span>

    To this:
    <span class="wu-day-current-temp">{{ day.temperature }}<sup>&deg;</sup></span>

    I am looking for the real solution for rounding the temperature values correctly using Twig.

    You can change line 27 mentioned above from:
    <span class="wu-day-current-temp">{{ day.temperature | round }}<sup>°</sup></span>

    to:
    <span class="wu-day-current-temp">{{ day.temperature | number_format }}<sup>°</sup></span>

    And the twig template will no longer throw an error. You can read more about number formats for Twig here:
    http://twig.sensiolabs.org/doc/filters/number_format.html

    Plugin Author Zack Katz

    (@katzwebdesign)

    Do you have another plugin or template that runs Twig? If so, it sounds like that Twig library is being loaded instead of the Wunderground one.

    Yes. There is more than one plugin using Twig. Does WP intend to integrate Twig into core libraries I wonder?

    Plugin Author Zack Katz

    (@katzwebdesign)

    @509tyler I would give that a 1% chance of happening!

    So, please try updating your other plugin’s Twig library, if possible.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Twig error after updating’ is closed to new replies.