• hello,

    I have a custom WP_Query which is grabbing the latest 5 events on my home page.

    $args = array(
            'post_type' => 'event',
            'post_status' => 'publish',
            'posts_per_page' => 5,
        );
    
        $loop = new WP_Query( $args );
        if($loop->have_posts()):

    Within my loop can I grab the event instance and use things such as #_EVENTDATES rather than writing it all again myself.

Viewing 1 replies (of 1 total)
  • You could do something like this:

    $post = $loop->the_post();
    $postid = get_the_ID();
    $EM_Event = em_get_event($postid, 'post_id');
    $eventdate = $EM_event->output_dates();

    Look in wp-content/plugins/events-manager/classes/em-event.php to see how the various placeholders are expanded out (e.g. #_EVENTDATES)

Viewing 1 replies (of 1 total)
  • The topic ‘Get events custom WP_Query’ is closed to new replies.