0
我想通過Wordpress統計(現在稱爲Jetpack)基於頁面瀏覽量獲得前10個帖子。 我管理挖掘在論壇小時(因變量和代碼改變不時)之後得到這個代碼工作(約..):stats_get_csv(WordPress的統計)只顯示頂部帖子(不是頁面)
<?php
if (function_exists('stats_get_csv') && $top_posts = stats_get_csv('postviews', 'days=-1&limit=10')) {
echo '<ol class="most-viewed">';
foreach ($top_posts as $post) {
if($post['post_id'] && get_post($post['post_id']))
echo '<li><a href="' . get_permalink($post['post_id']) . '">' .
get_the_title($post['post_id']) . '</a> (' . number_format_i18n($post['views']) .' visits)</li>';
}
echo '</ol>';
}
?>
現在我想排除此頁面名單,只有職位。問題是WordPress.com Stats API不提供post_type過濾器。我應該把這個地方
if (!isset($post->post_type) || $post->post_type != 'post')
你能幫我指出應該在哪裏添加它嗎?
在此先感謝! :d