記得在剛裝Wordpress之初,就有打算要加上人數的計數器,不過很奇怪的怎麼試都失敗,不知道問題出在哪裡,今天剛剛就想到,恩再來試試看,用的是一般的 WP-PostViews 1.50 ,看樣子也很久沒更新了。

Website:
» http://lesterchan.net/

Features:
» Enables you to display how many times a post/page had been viewed.

Download:
» WP-PostViews 1.50 For WordPress 2.8.x
» WP-PostViews 1.40 For WordPress 2.7.x
» WP-PostViews 1.31 For WordPress 2.3.x, 2.5.x And 2.6.x
» WP-PostViews 1.11 For WordPress 2.1.x And 2.2.x
» WP-PostViews 1.02 For WordPress 2.0.x

via. 這裡

其實安裝過程很簡單,只要把下載回來的檔案解壓後,放到 wp-content/plugins 資料夾裡即可,預設資料夾名稱為wp-postviews,記得到管理模式裡的plug-in裡去Activate WP-PostViews Plugin,。

用法也不難,不過不知道為啥第一次裝一直失敗。

目前我只單純顯示在獨自頁面和側邊欄的一個而已。

下方為安裝方式

  1. Open wp-content/themes/<YOUR THEME NAME>/index.php

至theme資料夾下的找到所使用的主題,開啟index.php

  1. You may place it in archive.php, single.php, post.php or page.php also.

也可以在找到以上檔案後,將以下程式碼放進頁面

  1. Find:
  2. <?php while (have_posts()) : the_post(); ?>

找到 <?php while (have_posts()) : the_post(); ?> 後

  1. Add Anywhere Below It:
  2. <?php if(function_exists(‘the_views’)) { the_views(); } ?>

在下方任意處將<?php if(function_exists(‘the_views’)) { the_views(); } ?> 貼上

  1. Go to ‘WP-Admin -> Settings -> PostViews’ to configure the plugin.

 

ps:其實我是在 index.php檔和single.php檔修改而已,而我是放在

<?php edit_post_link(‘Edit’, ‘<span class="edit">’, ‘</span> ‘); ?>

的下方。如下圖所示:

image

最後顯示的結果會是。

image

再此還有更完整的設定內容可以進來參考看看:readme

 

其實還有另外一個叫 WordPress Plugin :: WP-PostViews Plus

好像有比較好的樣子,不過下次再用。

Hits: 12