HotNews Pro 2.72集成的固定在页面左侧的百度分享按钮,可方便读者分享自己喜欢的文章,本文教你把这个固定的分享按钮添加到其它主题中。
第一步,在你所用主题目录新建一个名称为:share.php的模板文件,将下面的代码复制到进去并保存:
代码如下<script type="text/javascript" id="bdshare_js" data="type=tools&uid=0" ></script>
<script type="text/javascript" id="bdshell_js"></script>
<script type="text/javascript">
document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000)
</script>
第二步,将调用代码:
添加到主题页脚模板footer.php这句上面:
代码如下
以上代码在WP默认主题Twenty Twelve中测试通过,针对不同主题的页面宽度,可适当调整固定按钮的位置,代码中有注释。
[wordpress主题]WordPress添加一个位置固定的百度分享按钮
http://m.bbyears.com/wangyezhizuo/44010.html
推荐访问:wordpress教程 wordpress大学