WordPress-如何显示作者最近两周的帖子?

在author.php中, 我想显示作者发表的最近两周的帖子。看起来很简单, 但可以在Google中找到答案。


#1


你可以将wp_query与以下参数一起使用。

$args = array(
    'post_type' => 'post', 'orderby'   => 'date', 'author'    => $author_id, 'posts_per_page' => -1, 'date_query' => array(
        array(
            'after' => '2 weeks ago'
        )
    )
);

$query = new WP_Query( $args );

来源:

https://www.srcmini02.com/64363.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37471.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?