Support

Account

Forum Replies Created

  • The first query gets the dates picked in the posts and the second query compares all posts to the dates and lists all of the post that have picked that date, for example:
    July 10th, 2019

    • Post Name 1 – start time 7am
    • Post Name 2 – start time 8am
    • Post Name 3 – start time 9am

    July 11th, 2019

    • Post Name 4 – start time 6am
    • Post Name 5 – start time 9am
    • Post Name 6 – start time 11am

    That is what I need the code to do, but it is currently ordering it by published date/time.

  • I have added your code and it still does not work. Here is a link to my site and the page it is implemented on – https://www.cosmeticsurgeryforum.com/agenda/

  • My updated 2nd query and it still does not order the posts right. With this second query I need the posts to be ordered by time. The meta_query shows posts that match the date and then it should order them by start_time

    
    $date_query = new WP_Query(array(
        'post_type'         =>'sessions', 
        'posts_per_page'    => -1,
        'meta_query' => array(
            'date_clause' => array(
                'key'       => 'session_date', 
                'compare'   => '=',
                'value'     => $dayKey,
                'type'      => 'date'
            ),
            'time_clause' => array(
                'key' => 'start_time',
                'compare' => 'EXISTS',
            ), 
        ),
        'orderby' => array( 
            'time_clause' => 'ASC',
        ),
    ));  ?>
    
  • That just unordered my initial dates and still does not order the posts by time.
    It is supposed to show up like:
    Day 1
    Event 1 – 7am
    Event 2 – 8am
    Event 3 – 9am
    Day 2
    Event 4 – 7am
    Event 5 – 8am
    Event 6 – 9am
    Day 3
    Event 7 – 7am
    Event 8 – 8am
    Event 9 – 9am

Viewing 4 posts - 1 through 4 (of 4 total)