自分用メモ
Counterize IIのカウンターリセットが毎日9時になっていたので、下記に変更し0時にリセットするように変更
修正前
<br /> // Returns amount of hits today.<br /> function counterize_gethitstoday()<br /> {<br /> global $wpdb;<br /> $today = date("Y-m-d");<br /> $sql = "SELECT COUNT(1) FROM " . counterize_logTable() . " WHERE timestamp &gt;= '{$today}'";<br /> return $wpdb-&gt;get_var($sql);<br /> }<br />
修正後
<br /> // Returns amount of hits today.<br /> function counterize_gethitstoday()<br /> {<br /> global $wpdb;<br /> $today = date("Y-m-d", current_time('timestamp'));<br /> $sql = "SELECT COUNT(1) FROM " . counterize_logTable() . " WHERE timestamp &gt;= '{$today}'";<br /> return $wpdb-&gt;get_var($sql);<br /> }<br />
5/31追記 昨日分のカウンターも下記のように修正
修正前
<br /> //Returns amount of hits yesterday<br /> function counterize_gethitsyesterday()<br /> {<br /> $today = date("Y-m-d");<br /> $yesterday = date("Y-m-d", strtotime("-1 day"));<br /> $sql = "SELECT COUNT(1) FROM ".counterize_logTable()." WHERE timestamp >= '$yesterday' AND timestamp < '$today' "; $wpdb =& $GLOBALS['wpdb']; return $wpdb->get_var($sql);<br /> }<br />
修正後
<br /> //Returns amount of hits yesterday<br /> function counterize_gethitsyesterday()<br /> {<br /> $today = date("Y-m-d", current_time('timestamp'));<br /> $yesterday = date("Y-m-d", strtotime("-1 day"));<br /> $sql = "SELECT COUNT(1) FROM ".counterize_logTable()." WHERE timestamp >= '$yesterday' AND timestamp < '$today' "; $wpdb =& $GLOBALS['wpdb']; return $wpdb->get_var($sql);<br /> }<br />