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

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

HotNews Pro 2.72集成的固定在頁(yè)面左側(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'); ?>

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

  1. <?php wp_footer(); ?>

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

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

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

徹底解決AMD顯卡win10開機(jī)黑屏問題

遇上個(gè)AMD R7 350 顯卡 偶爾開機(jī)到了logo之后黑屏,找了各種法子沒解決,看到了這個(gè)辦法。試試看。來自小櫻看科技的公眾號(hào)。這邊做一下記錄避免丟了。謝謝。小櫻的辦公用電...
百科知道

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

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

發(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)證