
內容簡介
這個外掛非常容易使用。請參閱以下內容。
它會儲存單一文章的所有瀏覽次數。您可以設定讓它忽略已登入的使用者,或是停用某些文章的功能。
在文章檢視表格中,您會看到「瀏覽次數」欄位。您可以在設定中移除它。
所有瀏覽次數將會快取 24 小時。您可以停用它,或是更改快取清除的時間。
目前,Piggly Views 支援以下語言:
英文
葡萄牙文(巴西)
其他資源
您可以使用短碼 [piggly_views] 取得目前文章的瀏覽次數,或是使用 [piggly_views id="post_id"] 取得特定文章的瀏覽次數。它會依照設定中的格式返回瀏覽次數。
您可以使用 piggly_view_collection($limit,$days) 方法來取得瀏覽次數最高的文章。其中 $days 為「現在時間」與「過去 X 天」的範圍,$limit 為文章數量,$types 為文章種類的陣列,例如:post、page 或 attachment。
您可以使用短碼 [piggly_views_collection limit="X" days="X" types="post, page, attachment"] 取得瀏覽次數最高的文章的預設樣板。
取得瀏覽次數最高的文章
取得瀏覽次數最高的文章非常簡單,只需要使用全域函式 piggly_view_collection()。預設的 $days 值為 30,預設的 $limit 值為 5,而預設的 $types 陣列為「文章」。
// 取得過去 180 天內瀏覽次數最高的 10 篇文章。
$most_viewed = piggly_view_collection( 10, 180 );
if ( !empty( $most_viewed ) ) :
foreach ( $most_viewed as $post ) :
$postID = $post->post_id;
endforeach;
endif;
換句話說,您也可以使用短碼 [piggly_views_collection limit="10" days="180" types="post"] 來返回預設樣板。
當您使用 [piggly_views_collection] 短碼時,它會使用以下的樣板,您可以藉由使用 .pgl-views-post 來自訂 CSS。
>
>
>
{{title}}
>
> {{category}}
> {{author}}
> {{date}}
>
>
如何使用
從 WordPress 的管理介面中,前往「外掛程式 > 安裝的外掛」,並往下捲動直到找到「Piggly Views」。您需要先啟用它,然後點選「設定」進行設定。
設定
在文章檢視表格中顯示或隱藏「瀏覽次數」欄位。
停用已登入使用者的追蹤。
將瀏覽次數從 1000 轉換為「1K」格式。
快取瀏覽次數資料。
在停用外掛時保留選項和/或表格。
外掛標籤
開發者團隊
原文外掛簡介
The plugin is quite simple to use. See below.
It will store all views for a Single Post. You can configure it to ignore views to logged users and disable for some posts.
In the Posts View Table you will see the View column. You can remove it in configurations.
All views will be cached for 24 hours. You can disabled it or change the flush cache hour.
For now, Piggly Views is available in:
English,
Portuguese Brazilian.
Some additional resources
You can use the shortcode [piggly_views] to get views to the current post OR use [piggly_views id="post_id"] to a specific post. It will return the number of views following the format set in the settings.
You can get a collection of most viewed posts by using the method piggly_view_collection($limit,$days). Where $days is the range between NOW and X($days) days, $limit is the number of posts and $types is one or more post types slug into an array, such as: post, page or attachment.
You can use the shortcode [piggly_views_collection limit="X" days="X" types="post, page, attachment"] to get a collection of most viewed posts returning the default template.
Getting the most viewed posts
An easy way to get the most viewed posts is using the global function piggly_view_collection(). The default $days values is 30, default $limit value is 5 and default $types array is post.
// 10 most viewed posts in the last 180 days.
$most_viewed = piggly_view_collection( 10, 180 );
if ( !empty( $most_viewed ) ) :
foreach ( $most_viewed as $post ) :
$postID = $post->post_id;
endforeach;
endif;
In the other side, you can use the shortcode [piggly_views_collection limit="10" days="180" types="post"] to return the default template.
When you use [piggly_views_collection] shortcode, it will return the following template for each post. Customize CSS as your needs by using .pgl-views-post as parent.
>
>
>
{{title}}
>
> {{category}}
> {{author}}
> {{date}}
>
>
How to Use
From your WordPress administration panel go to Plugins > Installed Plugins and scroll down until you find Piggly Views. You will need to activate it first, then click on Settings to configure it.
Configuration
Display or not View Column in Post Table.
Disable tracking for Logged Users.
Convert Views from 1000 to 1K format.
Cache Views Data.
Flush cache after X hours.
Keep options and/or table when uninstall the plugin.
