WordPress 非插件添加当前页面/文章的微信分
Dec032015
微信作为自媒体是越来越火,将WordPress和微信结合,发文章到微信在朋友圈内的传递速度是一种不能忽视的能量。昨天我发了一篇文章,叫《微信朋友圈小游戏打企鹅的技巧攻略》,一觉起来发现这篇文章被浏览了1,500余次,觉得有必要给自己的Wordpress博客弄一个分享微信二维码的东西。
下面是本站某片文章的二维码样式的效果,如果你想看看到底如何,可以用微信扫一扫试试!
工具/网站推荐
关于微信二维码的图片,我找到了两个网站可以生成:
- 连图二维码在线生成:点击前往
- 连图生成的图片链接形式为:
1http://qr.liantu.com/api.php?text=这里写需要生成的页面链接
例如:http://qr.liantu.com/api.php?text=http://www.seavia.com - 加网微信分享代码:点击前往
- 加网生成的图片链接形式为:
1http://s.jiathis.com/qrcode.php?url=这里写需要生成的页面链接
例如:http://s.jiathis.com/qrcode.php?url=http://www.seavia.com
实现代码
在Wordpress后台的外观-小工具里面,选择文本,在文本里面加上如下代码:这里使用的连图的图片链接,当然你也可以试试加网的~
1 |
打开微信,使用扫一扫来浏览当前页面就可以分享给朋友圈的好友哦!<span class="token script language-javascript"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span><span class="token punctuation">></span></span>document<span class="token punctuation">.</span><span class="token function">write</span><span class="token punctuation">(</span>'<span class="token operator"><</span>img src<span class="token operator">=</span>"<span class="token comment" spellcheck="true">//qr.liantu.com/api.php?w=120&m=0&text='+window.location.href+'" alt="qr" />');</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span></span> |
居中样式
如果需要美化二维码图片居中,可以在样式表style.css中添加以下代码,然后再把图片样式设置成居中即可:
1 |
.widget .aligncenter{margin:0 auto; display:block;} |
好了,快来试试酷炫的二维码吧!!
https://www.seavia.com/wordpress/wordpress-show-weixin-qrcode-without-plugins.html
WordPress 非插件添加当前页面/文章的微信分:等您坐沙发呢!
发表评论
