Custom Weather Plugin
A custom WordPress plugin that adds an admin settings page to configure a city and API key, fetches live weather data from the OpenWeatherMap public API, and displays the result on the front end via a shortcode.
★ 0stars
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/pjpucan/cwp_weather/archive/refs/heads/master.zipReadme
Custom Weather Plugin
A custom WordPress plugin that adds an admin settings page to configure a city and API key, fetches live weather data from the OpenWeatherMap public API, and displays the result on the front end via a shortcode.
Features
- Admin settings page under Settings → Weather Plugin to save your API key, city, temperature unit, and cache duration.
- Public API fetch from OpenWeatherMap using WordPress-native
wp_remote_get(), with responses cached via Transients to minimise API calls. - Front-end output through the
[weather_display]shortcode, which renders a clean, accessible weather card on any page or post.
Requirements
- A free OpenWeatherMap API key
Installation
- Upload the
custom-weather-pluginfolder to/wp-content/plugins/. - Activate via Plugins → Installed Plugins.
- Go to Settings → Weather Plugin and enter:
- Your free OpenWeatherMap API key (register at https://openweathermap.org/api)
- The city name (e.g.
Manila,PH) - Preferred temperature unit
- Cache duration in minutes
- Add
[weather_display]to any page or post.
Shortcode Usage
Default (uses the city saved in settings):
[weather_display]
Override city inline:
[weather_display city="Manila,PH"]
Override both city and units:
[weather_display city="Sydney,AU" units="imperial"]