一、和风天气
个人免费版,无限次数,国内主要城市。
1、复制以下代码或者自己创建代码:和风天气创建页面(未注册亦可生成使用)
<div id="he-plugin-simple"></div>
<script>
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"
}
}
</script>
<script src="https://widget.heweather.net/simple/static/js/he-simple-common.js?v=1.1"></script>
2、复制后,找到主题目录下管理左侧,顶部,或者右侧的php文件,例如右侧:sidebar.php
,顶部:headnav.php
等,放在合适位置即可。
二、中国天气
个人免费版,无限次数,国内主要城市。
1、复制以下代码或者自己创建代码:中国天气免费天气预报代码(需注册)
<div id="weather-v2-plugin-simple"></div>
<script>
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"
}
}
</script>
<script src="https://apip.weatherdt.com/simple/static/js/weather-simple-common.js?v=2.0"></script>
2、复制后,找到主题目录下管理左侧,顶部,或者右侧的php文件,例如右侧:sidebar.php
,顶部:headnav.php
等,放在合适位置即可。
三、心知天气
个人免费版,20次/分钟,无限次数,国内370个主要城市。
1、复制以下代码或者自己创建代码:心知天气(需注册)
<div id="tp-weather-widget"></div>
<script>(function(T,h,i,n,k,P,a,g,e){g=function(){P=h.createElement(i);a=h.getElementsByTagName(i)[0];P.src=k;P.charset="utf-8";P.async=1;a.parentNode.insertBefore(P,a)};T["ThinkPageWeatherWidgetObject"]=n;T[n]||(T[n]=function(){(T[n].q=T[n].q||[]).push(arguments)});T[n].l=+new Date();if(T.attachEvent){T.attachEvent("onload",g)}else{T.addEventListener("load",g,false)}}(window,document,"script","tpwidget","//widget.seniverse.com/widget/chameleon.js"))</script>
<script>tpwidget("init", {
"flavor": "bubble",
"location": "WX4FBXXFKE4F",
"geolocation": "enabled",
"position": "top-right",
"margin": "10px 10px",
"language": "auto",
"unit": "c",
"theme": "chameleon",
"uid": "U9AE56E49E",
"hash": "579b04a19cd078b22a7694878be268ff"
});
tpwidget("show");
</script>
2、复制后,找到主题目录下管理左侧,顶部,或者右侧的php文件,例如右侧:sidebar.php
,顶部:headnav.php
等,放在合适位置即可。
四、推荐文档
1、HandSome主题顶栏显示天气 - 梁Sir's Blog
2、在Handsome主题中添加和风天气插件 - LingN'Blog
3、Typecho博客中显示天气 - 科技花