• I’m doing a newspaper website, and I need to make a loop with the news of the day. ie, in the loop must have the post of the current day, but there is an issue.

    The day ends at 12:00AM, but my client will upload the news at 8:00 AM. So, I need to show the last day posts until 8:00 from the next day. It’s like day starts at 8:00 AM and not 12:00 AM.

    How can I do this loop?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter alvarols

    (@alvarols)

    Yes but I don’t know exactly how I have to do. I am checking this code.

    // Create a new filtering function that will add our where clause to the query
    function filter_where( $where = ” ) {
    // posts 30 to 60 days old
    $where .= ” AND post_date >= ‘” . date(‘Y-m-d’, strtotime(‘-60 days’)) . “‘” . ” AND post_date <= ‘” . date(‘Y-m-d’, strtotime(‘-30 days’)) . “‘”;
    return $where;
    }

    add_filter( ‘posts_where’, ‘filter_where’ );
    $query = new WP_Query( $query_string );
    remove_filter( ‘posts_where’, ‘filter_where’ );

    I can put something like, show me the posts published today from 8:00. But it won’t work from 12:00 AM to 7:59 AM the next day before my client publishs the new posts at 8:00 AM.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Post loops from a specific interval of time’ is closed to new replies.