添加一個(gè)位置固定的百度分享按鈕

添加一個(gè)位置固定的百度分享按鈕

HotNews Pro 2.72集成的固定在頁面左側(cè)的百度分享按鈕,可方便讀者分享自己喜歡的文章,本文教你把這個(gè)固定的分享按鈕添加到其它主題中。

第一步,在你所用主題目錄新建一個(gè)名稱為:share.php的模板文件,將下面的代碼復(fù)制到進(jìn)去并保存:

  1. <div id="share">
  2. <div class="share">
  3. <div id="bdshare"class="bdshare_t bds_tools get-codes-bdshare">
  4. <a class="bds_tsina"></a>
  5. <a class="bds_tqq"></a>
  6. <a class="bds_qzone"></a>
  7. <a class="bds_renren"></a> 
  8. <span class="bds_more"></span>
  9. </div>
  10. <div style="clear:both;"></div>
  11. </div>
  12. </div>
  13. <script type="text/javascript" id="bdshare_js" data="type=tools&amp;uid=0" ></script>
  14. <script type="text/javascript" id="bdshell_js"></script>
  15. <script type="text/javascript">
  16. document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(newDate()/3600000)
  17. </script>
  18. <style type="text/css">
  19. #share {
  20. display:block;
  21. width:35px;
  22. margin-left:-546px;/* 修改左右位置 */
  23. position:fixed;
  24. left:50%;
  25. top:420px;/* 修改上下位置 */
  26. _margin-left:-546px;/* IE6修改左右位置 */
  27. _position:absolute;
  28. _margin-top:420px;/* IE6修改上下位置 */
  29. _top:expression(eval(document.documentElement.scrollTop));
  30. }
  31. .share {
  32. background:#fff;
  33. width:24px;
  34. border: 1px solid #ccc;
  35. border-radius:5px 0 0 5px;
  36. }
  37. #bdshare_l {
  38. border-radius: 5px;
  39. }
  40. div #bdshare_l_c {
  41. border: 1px solid #ccc;
  42. border-radius: 5px;
  43. }
  44. #bdshare h6, #bdshare_s h6,#bdshare p, #bdshare_s p {
  45. display:none;
  46. }
  47. </style>

第二步,將調(diào)用代碼:

  1. <?php include('share.php'); ?>

添加到主題頁腳模板footer.php這句上面:

  1. <?php wp_footer(); ?>

以上代碼在WP默認(rèn)主題Twenty Twelve中測試通過,針對(duì)不同主題的頁面寬度,可適當(dāng)調(diào)整固定按鈕的位置,代碼中有注釋。

添加更多的百度分享網(wǎng)站按鈕點(diǎn)此查看方法

 
  • 本文由 米粒在線 發(fā)表于 2014年6月17日13:33:04
  • 轉(zhuǎn)載請(qǐng)務(wù)必保留本文鏈接:http://m.bjmhhq.com/24541.html
網(wǎng)站建設(shè)

寶塔面板設(shè)置Docker加速站提示錯(cuò)誤:全局配置文件有誤,請(qǐng)檢查Expecting value:line 1 column 1(char 0)解決方法

寶塔? docker? 修改加速 報(bào)錯(cuò):寶塔 設(shè)置失敗!讀取配置文件失?。篍xpecting value: line 1 column 1 (char 0)解決辦法: 打開文件:/etc/d...
百科知道

/var/log/maillog日志太大占滿/var空間如何清理

一、情景描述 節(jié)點(diǎn)磁盤空間告警,使用df -h查看發(fā)現(xiàn)是/var盤滿了,cd進(jìn)入/var目錄下,du -sch log/ 發(fā)現(xiàn)是log目錄占用空間大,cd切換到log目錄下,du -dh *查看是因...
百科知道

華碩路由器的ddns用不了, 還有哪個(gè)可以用,備選替代選擇

尊敬的華碩用戶: 為配合網(wǎng)絡(luò)安全法規(guī)及政策的要求,進(jìn)一步提升服務(wù)安全性與質(zhì)量,華碩將對(duì)ASUS DDNS服務(wù)進(jìn)行調(diào)整。當(dāng)前的ASUS DDNS服務(wù)將停止。我們?yōu)槟峁┝寺酚善鲀?nèi)嵌的其他第三方DDNS服...

發(fā)表評(píng)論

匿名網(wǎng)友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
確定

拖動(dòng)滑塊以完成驗(yàn)證