麥克斯的噗浪
Categories
- Plugins (39)
- Themes (29)
- Troubleshooting (24)
- 無痛系列 (20)
- 網誌 (179)
Recent Posts
- Error establishing a database connection
- 無法訂閱留言
- Warning: cannot yet handle MBCS in html_entity_decode()!
- WordPress 無法登入– blank page
- Maximum execution time of 30 seconds exceeded
- 佈景主題側邊欄位置錯誤
- Tags 變成數字
- 可視化編輯器不見 – Visual Editor Missing
- WordPress 2.9.1 Beta 1
- 免費主機安裝WordPress錯誤排除
- WordPress Default Theme Fixed
- WordPress database error
-
Popular Posts
Recent Comments
- max on 讓部落格首頁與WordPress安裝在不同的目錄
- vilu on 讓部落格首頁與WordPress安裝在不同的目錄
- 小琉球民宿 on 一個很多佈景主題展示與免費下載的網站
- 小琉球民宿 on WordPress 3.0 RC3
- Wordpress佈景主題產生器專家 on WordPress 3.0.1
- 台南網頁設計 on Tags 變成數字
- hornets on 一個線上字型測試網站 CSS Type Set
- max on 無痛安裝 WordPress Part I
- 小琉球民宿 on WordPress 2.7 倒數計時
- 小琉球民宿 on WordPress 2.8 預覽-佈景主題篇
- 小琉球民宿 on 無痛安裝 WordPress Part I
- max on WordPress 2.6.2
-
Recent Posts
Tag Cloud
Blogroll
麥克斯的WordPress社群
Meta
Tag Archives: Related Posts
顯示相關文章程式碼 – Related Posts
在WordPress討論區看到一則討論,提到利用tags的歸類方式顯示相關文章,只需要在檔案中加入一段程式碼就可以,對於不喜歡加裝外掛程式的朋友或是對WordPress程式有興趣的朋友都可以參考看看。 在想要顯示相關文章的地方加入以下的程式碼: <?php //for use in the loop, list 5 post titles related to first tag on current post $tags = wp_get_post_tags($post->ID); if ($tags) { echo ‘Related Posts’; $first_tag = $tags[0]->term_id; $args=array( ‘tag__in’ => array($first_tag), ‘post__not_in’ => array($post->ID), ‘showposts’=>5, ‘caller_get_posts’=>1 … Continue reading →
