WP Manifestindependent plugin directory
manifest / utilities / terere-o-mate

Tereré o Mate

Is it tereré weather or mate weather? A WordPress page that reads the temperature for any city and answers in one word.

by wilderko · github.com/wilderko/terere-o-mate · website

1stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/wilderko/terere-o-mate/archive/refs/heads/main.zip

A WordPress plugin that answers one question: is it tereré weather, or mate weather?

In Paraguay you are always drinking yerba mate. The only question is how. When it is hot you drink it cold, with ice, and call it tereré. When it is not, you drink it hot, slowly, and call it mate. The line sits at about 28 °C.

This plugin adds one full-screen page to your site that reads the current temperature for any city in the world and gives you the answer in a single word.

                    28 °C
  MATE  ──────────────┼──────────────  TERERÉ
   hot water          │          cold water, ice

What it does

  • One URL, /tiempo-para-terere-o-mate, rendering a complete HTML document.
  • Type any city; the page tells you what to drink there right now.
  • Defaults to Asunción.
  • Palette and background swap with the answer — amber for mate, green for tereré.
  • Temperature and geocoding come from Open-Meteo, which needs no API key and no account.

Install

Drop the folder into wp-content/plugins/ and activate it, or into wp-content/mu-plugins/ if you would rather it always be on. It renders itself entirely and never touches your theme, so it works with any of them.

cd wp-content/plugins
git clone https://github.com/wilderko/terere-o-mate.git

Then visit https://yoursite.com/tiempo-para-terere-o-mate.

Configure

Two constants, both optional, both set in wp-config.php before WordPress loads:

define( 'PPT_THRESHOLD', 28.0 );                    // °C — where mate becomes tereré
define( 'PPT_PATH', 'tiempo-para-terere-o-mate' );  // the URL path

Argentines who want to argue for 30 °C are welcome to.

Background photos

The two background photos are not included in this repository. The ones on the original site are not mine to relicense, so rather than ship something with a licence I cannot vouch for, I left them out.

The page works without them — you get the scrim gradient over the palette's ground colour, which looks fine, just quieter. To get the full effect, drop four files into assets/:

File Shown when Suggested size
mate.jpg + mate.webp below the threshold 1024 × 683
terere.jpg + terere.webp at or above the threshold 1000 × 417

They are picked up automatically as soon as they exist. The .webp is served to browsers that take it, the .jpg to everything else.

Notes on how it is built

The page is unusual for WordPress in a few ways, all deliberate:

  • It bypasses the theme entirely. template_redirect at priority 0, print the document, exit. No template hierarchy, no wp_head(), nothing to override. What you see is what is in the file.
  • It cannot be page-cached. Every request defines DONOTCACHEPAGE, because a cached temperature is a wrong temperature. That makes each request cost an upstream call, which is why the rate limiting below exists.
  • The browser never talks to the geocoder. Autocomplete goes through this site's own ?suggest= endpoint. Visitors' IP addresses and half-typed city names stay off third-party servers.
  • Only a name crosses the wire, never coordinates. The page resolves the name server-side and displays the geocoder's own label. This means the place shown always describes the coordinates the reading came from — you cannot craft a URL that puts "Reykjavík" next to Asunción's 34 °C.
  • Strict CSP, no unsafe-inline. Which is why the CSS and JS are files rather than inline blocks, despite being small enough to inline.

Rate limiting

Uncached pages that make upstream calls are amplifiers. There is a per-IP cap of 60 page requests and 30 autocomplete requests per minute, held in transients, returning 429 past that. Upstream calls time out at 3 seconds, refuse redirects, and cap the response body at 64 KB.

Failures are cached too, briefly, so a broken upstream does not get hammered. The last good reading for each location is kept for a week, so an outage renders a slightly stale number rather than a dash — the page says Lectura guardada when it is doing that.

Requirements

WordPress 5.6+, PHP 7.0+. No database tables, no options, no admin screen. It stores nothing but transients, all of which expire.

Licence

Code is GPL-2.0-or-later — see LICENSE.

The two bundled fonts, Archivo Black and IBM Plex Mono, are SIL OFL 1.1 and are not covered by the GPL — see assets/LICENSE-fonts.txt.

Weather data from Open-Meteo, CC BY 4.0.