WordPressで逆アクセスランキングの設置
WordPressに逆アクセスランキングを設置したかった。
ただ、広告が出ないタイプが必要。
プラグインか何かで済ませられないかと探すとドンピシャのがあった。
Sim Access
http://log.noiretaya.com/script/simaccess
「Download simaccess_1.1.1.zip」をダウンロードして解凍後、適当なディレクトリにアップする。
パーミッションを下記の通り変更。
simaccess ├ admin ├ class ├ log ( 707 or 777 ) ├ .htaccess ├ access.php ├ access.sqlite ( 606 or 666 ) ├ index.php └ rank.html ( 606 or 666)
ほんでそのディレクトリのURLを叩くとログイン画面が出るので、
ID:admin
PASS:pass
でログイン。
で、フッターかフッターに解析用のJSタグを埋めておく。
<script type="text/javascript"><!-- document.write("<script type=\"text/javascript\" src=\"./simaccess/access.php?referrer=" + document.referrer + "\"></script>"); //src部分は適宜書き換え // --></script>
アクセスランキングの表示はファイルに直接、
<?php include("rank.htmlへのパス"); ?>
と指定してもいいし、
Executable PHP widgetというプラグインを入れて、ウィジェットで呼び出してもいい。
尚、デフォのランキング表示はけっこう質素なので、
ol{ counter-reset:number;/* 名前を付けたカウンターをリセット */ list-style:none;/* olが数字を付けることをキャンセル */ margin:0; padding:0; } ol li{ /* リスト部分は好きに装飾! */ } ol li:before{ /* カウンタ(数字になる部分) */ counter-increment: number;/* 任意の名前を付けて! */ content: counter(number);/* 名前を付けたカウンターを呼び出し */ /* 色を変えたり、背景画像を敷いたり!自由自在! */ }
とか、
ol { counter-reset:li; /* Initiate a counter */ padding:0; /* Remove the default left padding */ list-style:none; /* Disable the normal item numbering */ } ol li { position:relative; /* Create a positioning context */ margin:0 0 6px 2em; /* Give each list item a left margin to make room for the numbers */ padding:4px 8px; border-top:2px solid #666; background:#f6f6f6; } ol li:before { content:counter(li); /* Use the counter as content */ counter-increment:li; /* Increment the counter by 1 */ /* Position and style the number */ position:absolute; top:-2px; left:-2em; width:2em; padding:4px 0; border-top:2px solid #666; color:#fff; background:#666; font-weight:bold; font-family:"Helvetica Neue", Arial, sans-serif; text-align:center; }
とかで装飾するとよろしいかと。
olタグとかよくわかんない、tableタグが良いとかHTMLタグを変更したい場合は「class.access.php」を書き換える。
関連記事
さくらvpsにワードプレスを導入
さくらvpsで立ち上げたサーバーにWordPressを導入した際のメモ。 ①ダウ ...
WordPressにてPHPのAPCuを使用して高速化を図る方法
先日本サイトのサーバにAPCuを導入した。しかしながら所感にも書いたとおりAPC ...
WordPressでテーマファイル内で共通の変数を設定及び使用する方法
WordPressでテーマ内の共通変数を設定し使用したかった。例えば記事一覧ペー ...
WordPressでCSSとHTMLコーディングデータから自作テーマを作成する方法
CSSとHTMLコーディングデータがあり、それをWordPressのテーマに反映 ...
gzip圧縮とキャッシュをhttpd.confで設定する
今まで共用サーバーで使っていたWordPressをVPSに移した。 せっかくなの ...