=== Multi County Weather Alerts === Version 8.8.3 Open Weather

Version: 8.8.3

Can use multiple Lat and Long

=== Multi County Weather Alerts ===     Version 8.8.3 Open Weather screenshot

multi-county-weather-alerts.zip — 5 KB

Download

Downloads: 12

Multi-County Weather Alerts

Version 8.8.3   |   By John Martin   |   GPL-2.0-or-later

Multi-County Weather Alerts displays active severe weather alerts for one or more locations on a WordPress page using data retrieved from the OpenWeather One Call API 3.0. Each location is displayed as an expandable alert panel.

At a glance: The plugin is configured by the site administrator. Visitors do not need an OpenWeather API key, and the plugin does not use visitor browser geolocation.

Features

  • Monitor multiple counties or locations from one shortcode.
  • Each location can have its own latitude and longitude.
  • Expandable/collapsible alert panels.
  • Shows the alert event name and description.
  • Automatically distinguishes clear locations from locations with alerts.
  • Color-coded alert indicators for different types of weather events.
  • Warning symbol and expandable arrow indicators.
  • Server-side caching using WordPress transients.
  • 60-second default cache period.
  • Uses OpenWeather One Call API 3.0.
  • WordPress settings page for the OpenWeather API key.
  • Shortcode-based display.
  • Designed to work with multiple locations on the same page.

Installation

  1. Upload the multi-county-weather-alerts plugin ZIP through WordPress → Plugins → Add New Plugin → Upload Plugin, or extract the plugin folder into wp-content/plugins/.
  2. Make sure the plugin folder contains multi-county-weather-alerts.php.
  3. Activate Multi-County Weather Alerts.
  4. In the WordPress dashboard, go to Settings → Weather Alerts.
  5. Enter your active OpenWeather API key and save the settings.
  6. Add the shortcode to the page where you want the alerts displayed.

OpenWeather API Key

The plugin requires an active OpenWeather One Call API 3.0 key. The API key is entered in:

WordPress Dashboard → Settings → Weather Alerts

The key is stored as a WordPress option and is used by the server when requesting weather alert data from OpenWeather.

API usage: OpenWeather API plans and usage limits can change. Check your OpenWeather account for your current request limits, pricing, and One Call API 3.0 usage.

Shortcode

The plugin uses the following shortcode:

[county_alerts locations="Craighead County|35.8423|-90.7043"]

Multiple Locations

You can add multiple locations by separating them with commas:

[county_alerts locations="Craighead County|35.8423|-90.7043,Greene County|36.1687|-90.5637"]

Each location uses this format:

Location Name|Latitude|Longitude

For example:

  • Location Name: Craighead County
  • Latitude: 35.8423
  • Longitude: -90.7043

Finding Latitude and Longitude

Use the coordinates for the county or location you want to monitor. Coordinates can be obtained from a mapping service or another reliable geographic reference.

How the Alert Display Works

Location With No Active Alerts

When no active alerts are returned for a location, the panel displays a ✓ Clear indicator and a message stating that there are currently no active weather warnings or statements for that area.

Location With an Alert

When active alerts are returned, the panel displays the first alert as the primary header indicator. Opening the panel reveals the available alert information, including the event name and description.

Alert Colors

The plugin automatically assigns colors based on the alert event. Tornado, thunderstorm, and extreme events receive the strongest warning treatment, while advisories, statements, and watches receive a different warning color. Other alerts use the standard alert color.

Updating the Cache Time

The plugin uses a WordPress transient to cache the alert response for each location. The default cache period in version 8.8.3 is 60 seconds.

The relevant line in the plugin is:

set_transient( $transient_key, $alert_data, 60 );

The final number is the cache time in seconds. For example:

  • 60 = 1 minute
  • 300 = 5 minutes
  • 600 = 10 minutes
Important: Reducing the cache time can increase the number of requests sent to OpenWeather. Increasing the cache time reduces requests but may make alert information less frequently refreshed.

How API Requests Work

For each configured location, the plugin requests weather data from OpenWeather. The returned alert information is stored temporarily in WordPress using a transient. While that cached response is available, visitors can be served the stored response instead of causing another OpenWeather request.

This caching is particularly useful on pages with many visitors or multiple configured counties.

Troubleshooting

API key error

Go to Settings → Weather Alerts and verify that the correct OpenWeather One Call API 3.0 key has been entered and saved.

No alerts are displayed

A location showing ✓ Clear means that no active alert data was returned for that location at the time of the request. Also verify the latitude and longitude in the shortcode.

The wrong county is displayed

Check the latitude and longitude associated with that location in the shortcode. The plugin uses the coordinates to request weather data.

Alerts are not updating immediately

The plugin caches responses for 60 seconds by default. If the cache period has been changed, the new value determines how frequently fresh data is requested.

The shortcode does not display anything

Make sure the shortcode is entered correctly and that the plugin is active. Also verify that an OpenWeather API key has been configured and that the shortcode contains at least one valid location.

Shortcode Examples

One County

[county_alerts locations="Craighead County|35.8423|-90.7043"]

Two Counties

[county_alerts locations="Craighead County|35.8423|-90.7043,Greene County|36.1687|-90.5637"]

Additional Locations

You can add additional locations using the same comma-separated format:

[county_alerts locations="Location One|LAT|LON,Location Two|LAT|LON,Location Three|LAT|LON"]

Privacy

This plugin does not request or use the visitor's browser location. The locations monitored by the plugin are explicitly configured by the WordPress administrator inside the shortcode.

Credits

Weather alert information is provided through the OpenWeather API.

OpenWeather

License

Multi-County Weather Alerts is released under the GNU General Public License, version 2 or later.

GNU GPL v2 License

Disclaimer

Weather alerts can change rapidly. This plugin is provided for informational purposes and should not be the sole source used for life-safety, emergency, travel, or other critical decisions. Always consult official weather and emergency management sources when severe weather threatens.

Scroll to Top