wordpress读取24小时内文章排行榜并分页
$post_num = 5; // 设置调用条数
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
//新建查询数组
$args=array(
'date_query' => array(
array(
'column' => 'post_date',
'after' => '1 day ago', //24小时内最新文章
),
),
'el_id' => 'blog-posts',
'prefix' => 'blog_post',
//'showposts'=>10, //文章数量
'meta_key' => 'views', //post_meta里文章阅读数统计字段名
'orderby' => 'meta_value_num',
'posts_per_page' => $post_num,
'paged' => $paged,
);
query_posts($args);