Sort event by start date but show until end date has passed on PHP query for Wordpress -


i have question sorting upcoming events on website php query. issue having events run on couple of days. i'd event remain visible until event end date has passed. right now, once event start date has passed, event moves bottom of event list. however, i'd stay in same chronological order of start date until end date over. hope makes sense! appreciated. here's query...

    <?php          $now = date('y-m-d h:i:s');          $args = array(             'post_type'         => 'events',             'posts_per_page'    => -1,             'meta_query'        => array(                 'relation'      => 'or',                 'date_upcoming_clause'   => array(                     'key'       => 'event_start_date',                     'compare'   => '>=',                     'value'     => $now,                     'type'      => 'datetime'                 ),                 array(                     'relation'      => 'and',                     'date_started_clause'   => array(                         'key'       => 'event_start_date',                         'compare'   => '<=',                         'value'     => $now,                         'type'      => 'datetime'                     ),                     'date_end_clause'   => array(                         'key'       => 'event_end_date',                         'compare'   => '>=',                         'value'     => $now,                         'type'      => 'datetime'                     ),                 ),             ),             'orderby' => array(                 'date_started_clause' => 'asc',                 'date_end_clause' => 'asc',                 'date_upcoming_clause' => 'asc',             ),         );          $the_query = new wp_query($args);      ?> 


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -