內容簡介
這是一個輔助外掛,可讓你使用 WordPress.com 統計數據來建立 WordPress 查詢。
此外掛使用 WordPress.com 統計數據 (包含在 Jetpack 內)來查找最受歡迎的文章。使用此外掛需要安裝 Jetpack。我建議使用 Jetpack 運行至少 30 天才能獲得有用的數據。
它會請求過去 30 天內 100 篇最受歡迎的文章。這包括文章和頁面,因為 WordPress.com 統計數據不允許你根據文章類型篩選。我會過濾此列表,只保留文章,然後將其排名存儲為文章元數據(“be_stats”)。
你可以編寫自訂查詢以列出流行的文章,或使用Display Posts Shortcode 插件來完成。以下是使用簡碼插件的範例:
[display-posts orderby=”popular”] – 列出十篇最受歡迎的文章
[display-posts orderby=”popular” posts_per_page=”4″] – 列出四篇最受歡迎的文章
[display-posts orderby=”popular” posts_per_page=”4″ tag=”basic”] – 列出標記為“basic”的四篇最受歡迎的文章
開發人員專用
你可以使用一些過濾器進行自定義。有關更多信息,請參閱外掛代碼。
be_stats_args - 用於傳遞給WordPress.com Stats API的參數。
預設值:array('days' => 30, 'limit' => 100)
範例:http://www.billerickson.net/code/customize-be-stats-arguments/
be_stats_update - 用於確定是否應該保存數據的條件。
預設值:'post' == get_post_type()
範例:http://www.billerickson.net/code/be-stats-change-ranking-conditions/
外掛標籤
開發者團隊
原文外掛簡介
This is a helper plugin to allow you to build WordPress queries using WordPress.com stats.
This plugin uses the WordPress.com stats (packaged in Jetpack) to find out your most popular posts. You must be running Jetpack for this plugin to work. I recommend running Jetpack for at least 30 days to get useful data.
It asks for the 100 most popular posts over the past 30 days. This includes both posts and pages, since their stats don’t let you filter based on post type. I filter this list down to just posts and then store its ranking as post meta (‘be_stats’).
You can write custom queries to list popular posts, or use the Display Posts Shortcode plugin to do it for you. Examples using the shortcode plugin:
[display-posts orderby=”popular”] – Lists the 10 most popular posts
[display-posts orderby=”popular” posts_per_page=”4″] – Lists the 4 most popular posts
[display-posts orderby=”popular” posts_per_page=”4″ tag=”basic”] – Lists the 4 most popular posts tagged “basic”
For Developers
There are a few filters available to you for customization. Refer to the plugin’s code for more information.
be_stats_args – arguments passed to WordPress.com Stats API.
Default: array( ‘days’ => 30, ‘limit’ => 100 )
Example: http://www.billerickson.net/code/customize-be-stats-arguments/
be_stats_update – Conditional for determining if stats data should be saved
Default: ‘post’ == get_post_type()
Example: http://www.billerickson.net/code/be-stats-change-ranking-conditions/
