为博客添加实时天气功能(和风天气、中国气象、心知天气)
eonegh • 2020 年 08 月 23 日
一、和风天气个人免费版,无限次数,国内主要城市。
WIDGET = {
CONFIG: {
"modules": "01234",
"background": 5,
"tmpColor": "4A4A4A",
"tmpSize": 16,
"cityColor": "4A4A4A",
"citySize": 16,
"aqiSize": 16,
"weatherIconSize": 24,
"alertIconSize": 18,
"padding": "10px 10px 10px 10px",
"shadow": "0",
"language": "auto",
"borderRadius": 5,
"fixed": "true",
"vertical": "middle",
"horizontal": "center",
"key": "ab70696888c44ccf90cb3dc181b7ccef"
}
}
2、复制后,找到主题目录下管理左侧,顶部,或者右侧的php文件,例如右侧:sidebar.php,顶部:headnav.php等,放在合适位置即可。
二、中国天气个人免费版,无限次数,国内主要城市。
1、复制以下代码或者自己创建代码:中国天气免费天气预报代码(需注册)
WIDGET = {
CONFIG: {
"modules": "01234",
"background": 5,
"tmpColor": "4A4A4A",
"tmpSize": 16,
"cityColor": "4A4A4A",
"citySize": 16,
"aqiSize": 16,
"weatherIconSize": 24,
"alertIconSize": 18,
"padding": "10px 10px 10px 10px",
"shadow": "1",
"language": "auto",
"borderRadius": 5,
"fixed": "ture",
"vertical": "middle",
"horizontal": "center",
"key": "k7HUmg0Z2u"
}
}
2、复制后,找到主题目录下管理左侧,顶部,或者右侧的php文件,例如右侧:sidebar.php,顶部:headnav.php等,放在合适位置即可。
三、心知天气个人免费版,20次/分钟,无限次数,国内370个主要城市。
1、复制以下代码或者自己创建代码:心知天气(需注册)
"flavor": "bubble",
"location": "WX4FBXXFKE4F",
"geolocation": "enabled",
"position": "top-right",
"margin": "10px 10px",
"language": "auto",
"unit": "c",
"theme": "chameleon",
"uid": "U9AE56E49E",
"hash": "579b04a19cd078b22a7694878be268ff"
});
tpwidget("show");
2、复制后,找到主题目录下管理左侧,顶部,或者右侧的php文件,例如右侧:sidebar.php,顶部:headnav.php等,放在合适位置即可。
四、推荐文档