set access counter
September 16th, 2007### environment ###
OS : fedora core Linux 7
php : 5.2.2(cli)
mysql : 5.0.37
###################
I set access counter on right side below by wordpress plugin.
First of all, I downloaded “Counterize plugin” [counterize.php] from the following site:
http://andersdrengen.dk/projects/counterize/
Download four imagefiles too.
Rename “counterize.phps” to “counterize.php”
and place them in wp-content/plugins/ .
I logined wp-admin page and activated Counterize in plugins menu.
But mysql create table error occurred.
it is written on the plugin site about case of MySQL version 4.
But my MySQL version is 5 …
I created new table by myself.
create table wp_Counterize
(
id integer not null auto_increment,
IP varchar(16) not null default ‘unknown’,
timestamp timestamp default current_timestamp not null,
url varchar(255) not null default ‘unknown’,
referer varchar(255) not null default ‘unknown’,
useragent text,
primary key(id)
);
Attention:
Don’t change the field name.
If you changed, it is necessary to change counterize.php too.
I wanted to display this counter on right side below,
I edited sidebar.php as follows:
% vi wp-content/themes/default/sidebar.php
line 59: <li><h2>Meta</h2><h2>
……………
……………
line 68: </h2></li><?php echo “Total Hits: “. counterize_getamount(); ?>
The above function displays a simple number of hit.
Please refer to the plugin site or counterize.php source for the function names and the roles.
Go to wp-admin -> manage -> counterize.
Very cool statistical information can be seen.