• Hi there,

    I have this page where i display post and event together. I was able to get them and paginate and filter and all until i realize that records from event are also showing past events. i only want to display events which are either happening today or in future.

    $args = array(
                    'post_type' => array('post','event'),
                    'posts_per_page' =>$posts_per_page,
                    'paged' => $paged
                );
        $post = new WP_Query($args);

    any help please

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter stealthmedia19

    (@stealthmedia19)

    This is what i used to get my results.

    $args = array(
                    'post_type' => array('post','event'),
                    'posts_per_page' =>$posts_per_page,
                    'paged' => $paged,
                    'suppress_filters'=>false,
                    'meta_query' => array(
                        'relation' => 'OR',
                        array(
                            'key' => '_eventorganiser_schedule_start_finish',
                            'value' => date('Y-m-d h:i:s', time()),
                            'type' => 'DATETIME',
                            'compare' => '>=',
                        ),
                        array(
                            'key' => '_eventorganiser_schedule_start_finish',
                            'compare'  => 'NOT EXISTS'
                        )
                    )
                );
Viewing 1 replies (of 1 total)
  • The topic ‘Get Only Active event’ is closed to new replies.