• Can someone give me advice please.

    I’m trying to get items on a page to list in order of time, so the correct output should be:

    21:20 , 19:45 , 18:05 , 17:40 , 17:00

    but what I’m getting is:

    21:20 , 19:45 , 18:05 , 17:00 , 17:40

    hours and mins are in separate columns on the db and the code looks like this:

    $friday_query = new WP_Query(array(
                'post_type' => 'band',
                'meta_query' => array(
                    array('key' => 'stage_name', 'value' => $post->ID, 'compare' => 'LIKE'),
                    array('key' => 'stage_day', 'value' => 'friday', 'compare' => 'LIKE'),
                    array('key' => 'stage_hours', 'value' => '', 'compare' => '!='),
                    array('key' => 'stage_mins', 'value' => '', 'compare' => '!=')
                ),
                'meta_key' => 'stage_hours',
                'order' => 'DESC',
                'orderby' => 'meta_value'
            ));

    How the hell do I make it work? I’ve tried: ‘orderby’ => ‘stage_hours stage_mins’ ? Because in my head that should work. But it doesn’t :/

    Cheers,

    D

  • The topic ‘Ordering by multiple columns’ is closed to new replies.