1

I've few Custom Post Type "Events" on different dates. Event Date is coming from Metabox. Example:

Event Title 1 - Event Date: 20-10-06

Event Title 2 - Event Date: 20-03-26

Event Title 3 - Event Date: 20-01-19

Event Title 4 - Event Date: 20-06-12

Event Title 5 - Event Date: 20-12-10

I need to arrange those Post Titles by latest upcoming event dates. It should be like this: Event Title 3 Event Title 2 Event Title 4 Event Title 1 Event Title 5

I've made my query like this:

  $args = array(
    'posts_per_page'   => 5,                        
    'order'            => 'DESC',                          
    'meta_key'         => '_event_date',                          
    'orderby'          => 'meta_value',
    'post_type'        => 'events'
    );


   $args2 = array (
      'post_type'               => 'events',
      'posts_per_page'          => 3,
      'post__not_in'            => $do_not_duplicate,
      'offset'                  => '3',

      'order'                   => 'DESC',                          
      'meta_key'                => '_event_date',                          
      'orderby'                 => 'meta_value',

      ); 

NOTE: I've two queries there for two Blocks( Left Block 3 Posts, Right Block 3 Posts). I need to show latest upcoming events on left side and those events PAST shows on right side by Post date order.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.