In author.php I want show last two weeks posts published by the author. looks pretty simple but can find answer in Google.
You can use wp_query with following arguments.
$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 );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.