wordpress 获得当天文章数的代码

129,728次阅读
没有评论

共计 216 个字符,预计需要花费 1 分钟才能阅读完成。

在自制小工具代码也或者主题的相应地方加入以下代码即可:

function get_today_post_count() { 
    $today = getdate(); 
    $query = new WP_Query('post_type='. 'post'.'&year='. $today['year'].'&monthnum='. $today['mon'].'&day='. $today['mday']); 
    return $query->post_count; 
}

 

正文完