WP_Query: Show posts in a certain order for a certain time


I would like to display each post in the order specified under post__in on my home page for one day. That means first the post with ID 3 should be shown until 23:59:59, then the post with ID 1 for 24 hours until 23:59:59, then the post with ID 2 and so on. When all posts have been shown, it should start again from the beginning. Does anyone have an idea how to implement this?

function post_of_the_day( $query_args) {
    global $post;
    $query_args = array(
            'post_type'      => 'example_post_type',
            'posts_per_page' => 1,
            'post__in'       => array(3, 1, 2, 4, 7, 6, 5)

     return $query_args;

RaWa 2 years 2020-12-22T12:10:25-05:00 0 Answers 4 views 0

Leave an answer