
網誌中有人發問到要如何將推文按鈕加入「首頁」以及「文章頁面」中,其實作法很簡單,只要開啟 WordPress 後台中的「外觀」然後打開「編輯器」並對以下兩支檔案作修改即可。

第一步:
在「主要索引頁模板 (index.php)」搜尋程式碼
<?php the_category(', ') ?>
第二步:
加入以下程式碼。(版面可能會因程式碼而有所變動,須自行調整;建議具備些微程式碼編輯基礎再行編輯)
注意!「你網誌的網址」此處記得改成自己網誌網址,否則不會作用喔!
<h2 align="right"> <a rel="nofollow" target="_blank" href="http://www.facebook.com/share.php?u=http://你網誌的網址/?p=<?php the_ID(); ?>"><img title="分享到臉書!" src="http://arisa520.myweb.hinet.net/facebook.png" /></a> <a rel="nofollow" target="_blank" id="idPlurk" href="http://plurk.com/?qualifier=shares&status=[分享] http:%2F%2F你網誌的網址/?p=<?php the_ID(); ?> (<?php the_title(); ?>)"><img title="分享到噗浪!" src="http://arisa520.myweb.hinet.net/plurk.png" /></a> <a rel="nofollow" target="_blank" href="http://twitter.com/home?status=[推薦] <?php the_title(); ?> http://你網誌的網址/?p=<?php the_ID(); ?>"><img title="分享到推特!" src="http://arisa520.myweb.hinet.net/twitter.png" /></a> </h2>
第三步:
在「單篇文章 (single.php)」搜尋程式碼
<?php the_category(', ') ?>
第四步:
加入以下程式碼。(版面可能會因程式碼而有所變動,須自行調整;建議具備些微程式碼編輯基礎再行編輯)
注意!「你網誌的網址」此處記得改成自己網誌網址,否則不會作用喔!
<h2 align="right"> <iframe src="http://funp.com/tools/buttoniframe.php?s=21" height="16" width="66" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe> <a rel="nofollow" target="_blank" href="http://www.facebook.com/share.php?u=http://你網誌的網址/?p=<?php the_ID(); ?>"><img title="分享到臉書!" src="http://arisa520.myweb.hinet.net/facebook.png" /></a> <a rel="nofollow" target="_blank" href="http://plurk.com/?qualifier=shares&status=[分享] http:%2F%2F你網誌的網址/?p=<?php the_ID(); ?> (<?php the_title(); ?>)"><img title="分享到噗浪!" src="http://arisa520.myweb.hinet.net/plurk.png" /></a> <a rel="nofollow" target="_blank" href="http://twitter.com/home?status=[推薦] <?php the_title(); ?> http://你網誌的網址/?p=<?php the_ID(); ?>"<img title="分享到推特!" src="http://arisa520.myweb.hinet.net/twitter.png" /></a> </h2>
相較於其他網誌使用的落落長的Code本網誌程式碼我已經精簡過了,希望對有需要的人會有幫助囉!
延伸閱讀:
- 在WordPress 安裝分享按鈕(PHP Code) | 石先生部落
- 幫部落格加上Plurk快速噗文按鈕[修訂] | 簡睿隨筆@新世界
- 新增Facebook推文計數按鈕的WordPress外掛: Facebook ShareCount | 簡睿隨筆@新世界
- 用 Google Reader 快速推文至 FunP、Facebook、Plurk
- 開心農場 – 七個鮮為人知的小技巧、小密技
- Facebook 把朋友作分類,輕鬆管理複雜訊息
- PPStream 無法觀看的解決方法(找不到服務器,無法播放)



11 個留言
歡迎留言