「UTW mod Related Post」で未来の投稿を表示しなくする
[WP:Plugin]UTWによる関連記事表示プラグイン「UTW mod Related Post」 | AOINA.COM
はとても便利なプラグインですが、未来の日付を設定して投稿予定中の記事も表示されてしまいます。
そこで、utw_mod_related_post.phpの41行目以下
$sql = "SELECT post_id, Sum(".substr($sql,1).") as weight ".
"FROM $tablepost2tag, $wpdb->posts ".
"where $tablepost2tag.post_id = $wpdb->posts.ID ".
" and post_id<>".$id." ".
" and post_status = 'publish' ".
"GROUP BY post_id ".
"HAVING weight>0 ".
"ORDER BY weight DESC, post_id DESC ".
"LIMIT ".$count;
を下記のように手直ししました。
$sql = "SELECT post_id, Sum(".substr($sql,1).") as weight ".
"FROM $tablepost2tag, $wpdb->posts ".
"where $tablepost2tag.post_id = $wpdb->posts.ID ".
" and post_id<>".$id." ".
" and post_status = 'publish' ".
" and post_date < NOW() ".
"GROUP BY post_id ".
"HAVING weight>0 ".
"ORDER BY weight DESC, post_id DESC ".
"LIMIT ".$count;
Related post:
- ループがだめなら、RSSで
- 元号表記に挑戦3
- Popularity Contestをリセット
- Tam-google-analyticsのちょっとしたTips
- WP-Amazon 1.3.2で日本語を通す


![Validate my RSS feed [Valid RSS]](http://kuchijinja.jp/bamboo/wp-content/themes/typoxp-2.0/img/rssvalid.gif)

