Support

Account

Home Forums General Issues Order by date

Unread

Order by date

  • hello,

    I have 3 fields:
    – date_event (if an event does not spread over a period),
    – date_start, and date_end.

    I would like to show all posts by ascending date. I do not know how to do. I managed to do that, but I do not want the value to be the current month. It does not matter the date.

    $pageCulture = new WP_Query(array(
          'posts_per_page' => -1,
          'post_type' => 'culture',
           'meta_query' => array(
                'relation' => 'OR',
                'date_manquante' => array(
                  'key' => 'date_event',
                    'compare' => 'LIKE',
                    'value' => '',
                ),
                'date_unique' => array(
                  'key' => 'date_event',
                    'compare' => 'LIKE',
                    'value' => $date_next_month,
                ),
                 'date_periode' => array(
                   'key'     => 'date_debut',
                    'value'   => array(date('Y-m-d',$start_month), date('Y-m-d',$end_month)),
                    'compare' => 'BETWEEN',
                    'type'    => 'DATE',
                ),
             ),
            'orderby' => array(
            'date_unique' => 'ASC',
            'date_periode' => 'ASC',
              ),
    ));
Viewing 1 post (of 1 total)

The topic ‘Order by date’ is closed to new replies.