中文 WordPress 工具箱的熱門文章
我用的Wordpress外掛「中文 WordPress 工具箱」裡面有顯示「評論最多的帖子」這個功能,也就是我的網站右手邊的「熱門文章」區塊。但是他會包含頁面,如我的花履歷以及留言版,都是用獨立的頁面做成的,這樣一來留言版也會出現在熱門文章裡頭,非常的不合邏輯。另外最新文章這一區塊也有這個問題,再怎麼說「留言板」都不應該當成是文章啊!所以我動手修改了這個外掛。
第103行
$mostcommenteds = $wpdb->get_results("SELECT $tableposts.ID as ID, post_title, post_name, COUNT($tablecomments.comment_post_ID) AS 'comment_total' FROM $tableposts LEFT JOIN $tablecomments ON $tableposts.ID = $tablecomments.comment_post_ID WHERE comment_approved = '1' AND post_date < '".date("Y-m-d H:i:s", (time() + ($time_difference * 3600)))."' AND post_status = 'publish' AND post_password = '' GROUP BY $tablecomments.comment_post_ID ORDER BY comment_total DESC LIMIT $limit");
改成這樣:
$mostcommenteds = $wpdb->get_results("SELECT $tableposts.ID as ID, post_title, post_name, COUNT($tablecomments.comment_post_ID) AS 'comment_total' FROM $tableposts LEFT JOIN $tablecomments ON $tableposts.ID = $tablecomments.comment_post_ID WHERE comment_approved = '1' AND post_date < '".date("Y-m-d H:i:s", (time() + ($time_difference * 3600)))."' AND post_status = 'publish' AND post_type = 'post' AND post_password = '' GROUP BY $tablecomments.comment_post_ID ORDER BY comment_total DESC LIMIT $limit");
第174行
$request = "SELECT ID, post_title, post_date, post_content FROM $tableposts WHERE post_status = 'publish' ";
改成這樣:
$request = "SELECT ID, post_title, post_date, post_content FROM $tableposts WHERE post_status = 'publish' AND post_type = 'post' ";
若你沒有修改其他任何地方,可以直接下載我的修改版,mulberrykit.php.txt,下載完後把檔名最後面的.txt刪掉,也就是說把 mulberrykit.php.txt改成mulberrykit.php,然後覆蓋到你的Plugins資料夾,就可以了。
- 人氣(806)
最新回應
- 最近發現國外有一套針對Drupal的佈景主題產生器,還不錯
4 天 6 小時前 - 您好:
冒昧打擾您了,
目前我有個專案正在進行,
很希望與
3 周 6 小時前 - .............
4 周 4 天前 - Our
9 周 4 天前 - 真是AJAX吗?
16 周 5 天前 - 不好意思
有個問題可以請問你嗎
javascript的基本
23 周 8 小時前 - 我工作的公司在找能協助維護一個用Drupal
26 周 9 小時前 - lol ,花水木粉絲萬歲~
27 周 12 小時前 - 其實在下原本就是花水木的fans啦…只是一直都不敢回文
31 周 1 天前 - 请问,可否发一个license呢
xiang.leau@g
32 周 5 天前
熱門內容
- Plurk2:噗浪插頭的貼紙美化 (13,355)
- [Module] AJAX Comments (7,493)
- [網站易用性] 下拉式選單的迷思 (6,366)
- Plurk2:花水木版圓角作法&原始檔 (6,207)
- Drupal開發用版型 (5,737)













回應
發表新回應