wordpress添加天气_如何在WordPress中显示天气预报

本文介绍了在WordPress中显示天气预报的方法,适合旅行、活动、酒店等行业的网站使用。推荐使用WP Cloudy插件,该插件可以获取OpenWeatherMap API以避免超时,并允许配置显示设置,创建和管理天气报告。
摘要由CSDN通过智能技术生成

wordpress添加天气

Do you want to show weather forecast in WordPress? Some website owners may want to display weather forecast to keep their users informed about weather conditions for specific locations. In this article, we will show you how to easily show weather forecast in WordPress.

您要在WordPress中显示天气预报吗? 一些网站所有者可能希望显示天气预报,以使他们的用户了解特定位置的天气状况。 在本文中,我们将向您展示如何轻松地在WordPress中显示天气预报。

Showing weather forecase in WordPress
为什么以及谁需要WordPress中的天气预报? (Why and Who Needs Weather Forecast in WordPress?)

Not all websites need to display weather forecast to their users. However, there are many industries that rely on people making decisions based on this information.

并非所有网站都需要向其用户显示天气预报。 但是,有许多行业依赖人们根据此信息做出决策。

This includes travel, events, hotels, bed & breakfasts and many others in the hospitality and tourism industry.

这包括旅游, 活动 ,酒店, 住宿加早餐旅馆以及酒店和旅游业的许多其他服务。

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.

有很多WordPress插件可以提取天气信息并将其精美地显示在您的网站上。 您需要使用快速,整洁且不添加指向气象服务的链接的插件。

That being said, let’s take a look at how to easily show weather forecast in your WordPress posts, pages, or a sidebar widget.

话虽如此,让我们看一下如何轻松地在WordPress帖子,页面或侧边栏小部件中显示天气预报。

在WordPress中添加天气预报 (Adding Weather Forecast in WordPress)

First thing you need to do is install and activate the WP Cloudy plugin. For more details, see our step by step guide on how to install a WordPress plugin.

您需要做的第一件事是安装并激活WP Cloudy插件。 有关更多详细信息,请参阅有关如何安装WordPress插件的分步指南。

WP Cloudy can work without an API key. However, it is recommended to create an OpenWeatherMap API key to avoid timeouts.

WP Cloudy无需API密钥即可工作。 但是,建议创建一个OpenWeatherMap API密钥以避免超时。

Simply head over to OpenWeatherMap website and click on the sign up link.

只需转到OpenWeatherMap网站,然后单击注册链接即可。

Sign up for open weather map api key

After sign up, you need to visit your profile page and click on the API Keys tab. You will be asked to provide a name for your keys and then click on the ‘Generate’ button.

注册后,您需要访问个人资料页面,然后单击“ API密钥”选项卡。 系统将要求您提供密钥名称,然后单击“生成”按钮。

Generate API Key

Open Weather Map will now generate an API key for you to use. You need to copy the API key.

Open Weather Map现在将生成一个API密钥供您使用。 您需要复制API密钥。

Next, you need to head over to Settings » WP Cloudy page in your WordPress admin area and click on the ‘Advanced’ tab.

接下来,您需要转到WordPress管理区域中的 “设置»WP Cloudy”页面,然后单击“高级”标签。

Enter api key

On this screen, you need to scroll down to the ‘Open Weather Map API key’ option and paste the API key you copied earlier.

在此屏幕上,您需要向下滚动到“打开天气地图API密钥”选项,然后粘贴之前复制的API密钥。

Don’t forget to click on save changes button to store your settings.

不要忘记单击“保存更改”按钮来存储您的设置。

You are now ready to create your weather reports. You can do this by visiting Weather » Add New page to create your first weather report.

现在您可以创建天气报告了。 您可以通过访问天气»添加新页面来创建您的第一份天气报告。

Creating a weather report

Simply enter the city, state, and country information and then switch to the ‘Display’ tab. Here you can configure different display settings. You can add / remove information that you want to show and configure the number of days to show in the forecast.

只需输入城市,州和国家/地区信息,然后切换到“显示”标签。 您可以在此处配置不同的显示设置。 您可以添加/删除要显示的信息,并配置要在预测中显示的天数。

Display settings

Once you are finished, click on the publish button to save your weather report and then copy the shortcode.

完成后,单击“发布”按钮以保存天气报告,然后复制简码。

Copy the weather shortcode

You can now add this shortcode to any WordPress post or page. You can also add this shortcode to a sidebar widget.

现在,您可以将此简码添加到任何WordPress 帖子或页面中 。 您也可以将此简码添加到侧边栏小部件中

After that, you can view your website to see the weather forecast in action.

之后,您可以查看您的网站以查看天气预报。

Weather forecaste displayed on a WordPress website

We hope this article helped you learn how to show weather forecast in your WordPress posts, pages, or sidebar widgets. You may also want to see our list of must have WordPress plugins for any website.

我们希望本文能帮助您学习如何在WordPress帖子,页面或侧边栏小部件中显示天气预报。 您可能还想查看我们的清单,该清单必须具有适用于任何网站的WordPress插件

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在TwitterFacebook上找到我们。

翻译自: https://www.wpbeginner.com/plugins/how-to-show-weather-forecast-in-your-wordpress/

wordpress添加天气

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值