
內容簡介
透過 Google Analytics 實時資訊取得熱門文章,每隔 10 分鐘新增一個名稱為「Popular RT」的分類,包含一定數量(預設為 10 篇)您所想要的熱門文章,以及每篇文章中活躍用戶的數量,方便您於 WordPress 的任何位置顯示您的部落格熱門文章。
以下提供查詢範例,包含分類和以閱讀數排序的文章數字。
<?php $args = array( 'posts_per_page' => 5, 'offset' => 0, 'category_name' => 'popular_real_time_cat', 'meta_key' => 'active_users', 'orderby' => 'meta_value_num', 'order' => 'DESC'); $queryWP = new WP_Query(); ?>
因為 Google Analytics 包含了根目錄 (/)、類別或標籤在內的活躍用戶,綁定到「Popular RT」的文章數字可能會少於您所選定的數量(預設為 10 篇)。
外掛標籤
開發者團隊
原文外掛簡介
Get popular posts from Google Analytics Real Time and set every 10 minutes a new category called “Popular RT” with a number (By default 10 Posts) of popular post that you want and the number of active users in every post in this category, ready for you display your blog´s trendy post in every place of your WordPress.
Query Example using the category and the number of views for sorting.
5, 'offset' => 0, 'category_name' => 'popular_real_time_cat', 'meta_key' => 'active_users', 'orderby' => 'meta_value_num', 'order' => 'DESC'); $queryWP = new WP_Query(); ?>
The number of posts assigned in “Popular RT” may be less than the number selected (By default 10) because Google Analytics also include root path / (Home), categories or tags if have more active users than another posts.
