Do you want to show a weather forecast in WordPress?
Some website owners may want to display a weather forecast to keep their users informed about weather conditions for specific locations.
In this article, we will show you how to easily add a weather forecast to your WordPress site.
Why and Who Needs Weather Forecast in WordPress?
Not all WordPress websites need to display a weather forecast to their users. However, some industries rely on people making decisions based on upcoming weather conditions.
There are plenty of WordPress plugins that can pull weather information and display it beautifully on your website. You need to use a plugin that is fast, clutter-free, and doesn’t add links to weather services.
That being said, let’s take a look at how to easily show weather forecast in your WordPress posts, pages, and sidebar widgets.
How to Show Weather Forecast in WordPress
Location Weather is a beginner friendly WordPress plugin that lets you add a weather forecast to any page, post, or widget. That’s helpful when you need to add forecasts for different locations throughout your website.
The free version includes the features many users need. However, if you wish to display multi-day forecasts or automatically detect the location of your visitors, then you’ll need to upgrade to the Pro version.
Location Weather can work without an API key. However, it is recommended to create an OpenWeatherMap API key to improve performance and avoid timeouts.
To do that, simply navigate to Location Weather » Settings in your WordPress dashboard. Here you can click on a link to get your OpenWeather API key.
Clicking the link will let you sign up for an account on the OpenWeatherMap website. After sign up, you need to visit your profile page and click on the API Keys tab.
Here you’ll find your default API key. Clicking on the key will automatically copy it.
You’ll need to return to your WordPress backend and paste the key into the OpenWeather API Key text box.
Don’t forget to click on the Save button to store your settings.
You are now ready to create your weather reports. You can do this by visiting the Location Weather » Add New page to create your first weather report.
Start by entering your location. With the free version, you just need to use the format ‘City, Country’. This should work fine for most locations.
But Location Weather may choose the wrong city if your country has more than one with that name. In that case, you’ll need to upgrade to the Pro version and use the City ID, ZIP or coordinates to identify the right one.
You’ll also need the Pro version if you want Location Weather to automatically detect your visitor’s location.
You should scroll down the page to make sure your preferred units for temperature, pressure, and wind speed are being used.
The Display Options tab allows you to choose the information that will be displayed. For this tutorial, we’ll just stick with the default settings.
Note that the free version will display today’s forecast. If you wish to display the forecast for more than one day, then you need to upgrade to a Pro plan.
You might like to scroll to the bottom of the page and switch the Weather Attribution setting to ‘Hide’. This makes sure the OpenWeatherMap link won’t be displayed on the forecast.
The Style Options tab lets you choose the background and text color. Again, we’ll stick with the defaults.
Once you are finished, click on the Update button to save your weather report. You’ll also need to copy the shortcode by clicking on it.
After that, you can visit your website to see the weather forecast in action.
You can repeat this process to create as many weather forecasts as you need.
We hope this tutorial helped you learn how to show a weather forecast in your WordPress website.