以下からダウンロード
http://www.navision-blog.de/counterize-ii-english/#comment-14048
以下の言語ファイルをリネーム
counterize-ja_UTF.mo ⇒ counterize-ja.mo
counterize-ja_UTF.po ⇒ ounterize-ja.po
以下のコードのうち、表示させたいものを任意の場所に貼り付け
累計PV:<?php echo counterize_getamount(); ?>
累計UU:<?php echo counterize_getuniqueamount(); ?>
本日PV:<?php echo counterize_gethitstoday(); ?>
本日UU:<?php echo counterize_getuniquehitstoday(); ?>
さらに改造
counterize.phpに以下の関数を入れれば、昨日分を表示できるようになる
counterize.phpの function counterize_gethitstoday() 関数の下あたりに以下を追加
# Returns amount of hits yesterday.
function counterize_gethitsyesterday()
{
$today = date("Y-m-d");
$yesterday = date("Y-m-d",strtotime("-1 day"));
$sql = "SELECT COUNT(1) FROM ".counterize_logTable()." WHERE timestamp >= '$yesterday' AND timestamp < '$today' ";
$wpdb =& $GLOBALS['wpdb'];
return $wpdb->get_var($sql);
}
テーマ側で
Today: < ?php echo counterize_gethitstoday();?>
Yesterday: < ?php echo counterize_gethitsyesterday();?>