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」を書き換える。
関連記事
WordPressで自動でmetaタグのkeywordsとdescriptionを表示
metaタグのkeywordsとdescriptionにて、基本的にはAll i ...
WordPressで固定ページに記事一覧を表示させるプラグイン
WordPressで固定ページ編集時にショートコードを書くことで、記事一覧を表示 ...
PHP8系で「Warning: Attempt to read property "xxxxxx" 」エラーの対応方法
PHP8系&WordPress6.4.3で「Warning: Attem ...
WordPressでメモリを節約しつつ高速化する設定方法
メモリ1GのVPSを借りてWordpress以外にも、ちょいちょいものを置いてい ...
WordPressで画像にカテゴリを設定し、記事投稿の際の画像選択時に指定したカテゴリの画像のみ表示させる方法
WordPressのメディアライブラリに画像を沢山登録していると、記事投稿の際の ...