How do I display posts by a specific date? If it is 15 July today, it'll display posts from about two or three days ago, like the 12th of July's posts. And tomorrow it'll display the 13th of July's post.
How can I achieve this?
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.Sign up to join this community
I think if you want to show recent posts posted 2-3 days ago, you can use date queries, provided by WordPress
You can get more information about date queries from here: WordPress Date Queries
For Example: If you want to show last three days posts, it can be done using the following snippet of code:
//set the arguments $args = array( 'order' => 'DESC', 'date_query' => array( array( 'after' => '3 days ago', ), ), ); // get posts using the arguments $posts = get_posts($args);
The above will return an array of posts from last 3 days to the current day. You can also use it like: 3 days ago, 1 week ago etc.