描述
PDS Weather shows current conditions in your area using the OpenWeatherMap API (free tier).
The plugin fetches and displays:
- Current weather description
- Current temperature (°C and/or °F)
- “Feels like” temperature
- Weather font icon (optional)
- City name display (optional)
Data is cached for one hour to minimize API calls.
Requirements:
- A free OpenWeatherMap API key — Get one here
Setup:
- Go to PDS Weather > Settings in your WordPress admin.
- Enter your OpenWeatherMap API key.
- Select your country and enter your city name.
- Choose display options (icon, degrees, feels like, weather label, city name).
- Save settings.
Display options:
- Use the PDS Weather Gutenberg block in the Block Editor.
- Use the PDS Weather classic widget (Appearance > Widgets).
- Use the
[pdsweather]shortcode in any post or page. - Or call
<?php echo pdsweather_display(); ?>in your theme template. - Legacy function
pdsWeather()is still supported for backward compatibility.
区块
该插件提供了 1 个区块.
- PDS Weather Displays current weather conditions for your configured city. Configure via PDS Weather → Settings.
安装
- Upload the
pdsweatherfolder to/wp-content/plugins/. - Activate the plugin through the ‘Plugins’ menu in WordPress.
- Go to PDS Weather > Settings and enter your OpenWeatherMap API key.
- Configure country, city, and display preferences.
- Add the widget or use
<?php echo pdsweather_display(); ?>in your templates.
常见问题
-
Where do I get an API key?
-
Sign up for a free account at OpenWeatherMap and create an API key. The free tier allows up to 1,000 calls per day.
-
The old Weather Underground API key no longer works. What do I do?
-
Weather Underground shut down their free API in 2019. Version 4.0 of this plugin uses OpenWeatherMap instead. Simply enter your new OpenWeatherMap API key in the settings.
-
How often does the weather data refresh?
-
The plugin caches data for one hour to minimize API calls.
评价
2016 年 9 月 3 日
1 回复
I’m redesigning my blog and this is small “personal-touch” addon.
I had one problem….right after install it is impossible to activate plugin from popup, but i have to go to plugin page and then activation works…
it would be nice to fixed that and then i’ll give you 5 stars
贡献者及开发者
更新日志
4.0.2
- Added Gutenberg block — insert weather directly from the Block Editor with live server-side preview.
- Added
[pdsweather]shortcode for easy embedding in posts and pages. - Added “Show city name” option in settings.
- Modernized front-end CSS: switched from floats to flexbox layout, added temperature separator.
- Added
.pdsweather-cityCSS class for city name styling.
4.0.1
- Fixed widget not appearing properly in Appearance > Widgets admin screen.
- Added configurable widget title field with proper sanitization.
- Widget now outputs title using before_title/after_title theme wrappers.
- Widget no longer outputs empty wrapper when no weather data is available.
- Added explicit ‘classname’ to widget constructor for proper CSS targeting.
- Added link to settings page inside widget form for easier configuration.
4.0.0
- BREAKING: Replaced defunct Weather Underground API with OpenWeatherMap API.
- Added nonce verification for all admin forms.
- Added capability checks (manage_options) on all admin pages.
- Added input sanitization (sanitize_text_field) for all user inputs.
- Added output escaping (esc_html, esc_attr, esc_url) for all outputs.
- Added option whitelist — only pdsweather_* options are accepted.
- Added ABSPATH checks to prevent direct file access.
- Moved inline JavaScript to separate enqueued file (js/pdsweather-admin.js).
- Replaced file_get_contents() with wp_remote_get().
- Added proper error handling for API calls.
- Updated plugin header (Tested up to: 6.7, Requires PHP: 7.4).
- Added Text Domain and load_plugin_textdomain() support.
- Renamed all functions/options with pdsweather_ prefix.
- Removed Weather Underground icon set options (no longer available).
- Improved uninstall.php with WP_UNINSTALL_PLUGIN check and legacy option cleanup.
- Added weather icon mapping for OpenWeatherMap condition codes.
- Legacy pdsWeather() function preserved as wrapper for backward compatibility.
3.3
- Bugfix when weather string is blank — set clear for weather.
3.2
- Solved bug for conditions after new year has started.
- Tested on 4.7.
3.1
- Removed print of the results after save.
- Tested on 4.5.
- Implement selective refresh for widget.
3.0
- Solved more bugs.
- Added input field for API key to the settings area.
- Made sure API key is required for widget to be shown.
- Added drag & drop widget in widgets section.
2.0
- Solved some bugs.
- Added input field for API key.
- Added uninstall functions.
1.1.1
- Another little bug solved.
1.1
- Solved bug with showing of the countries.
- Added F and °C for temperature strings.
1.0
- First version of the plugin.
- Weather conditions change once per hour.
- Shows conditions and feels like string.
- Uses WU icons and weather font.
