Query by date
-
Hello ! its posible create custom queries for display expiration post by date ?
Today, this week, this month…
Example :
switch ($date) { case 'today': return array( 'key' => '_expiration-date', 'value' => date('Y-m-d',strtotime("today")), 'compare' => '=', 'type' => 'DATE' ); break; case 'this-week': return array( 'key' => '_expiration-date', 'value' => array(date('YYYY-MM-DD',strtotime("Monday this week"), date('YYYY-MM-DD',strtotime("Sunday this week")))), 'compare' => 'BETWEEN', 'type' => 'DATE' ); break; case 'this-month': return array( 'key' => '_expiration-date', 'value' => array(date('YYYY-MM-DD',strtotime("Monday this week"), date('YYYY-MM-DD',strtotime("Sunday this week")))), 'compare' => 'BETWEEN', 'type' => 'DATE' ); break; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Query by date’ is closed to new replies.