I am using events-manager (a great event management plugin for Wordpress). It works really well and does a lot of things out of the box. That said, I have been trying to build a custom query for one of my events page, but caot seem to get this to work (ie. i am not able to query by custom fields, in this case event_owner). I have looked online for days, i have tried a million different snippets but nothing seem to work.
<?php
$loop = new WP_Query( array( 'post_type' => 'event', 'posts_per_page' => 100 ,
'meta_query' => array(
'key' => 'event_owner',
'value' => 1,
'compare' => '='
)
)
);
?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php
global $post;
$EM_Event = em_get_event($post->ID, 'post_id');
$latitude = $EM_Event->get_location()->location_latitude;
$longitude = $EM_Event->get_location()->location_longitude;
$date = $EM_Event->event_end_date;
$start_time = $EM_Event->event_start_time;
$attendees = $EM_Event->event_rsvp_spaces;
$attributes = $EM_Event->event_attributes;
$attributes_string = implode ('/' , $attributes);
echo $termsString;
?>
FYI - If i omit meta_key' => 'event_owner', 'meta_value' => 1 the loop works just fine. Also, while I am not a developer, i usually “get” things. Thanks a lot guys!
Many thanks,
Yvan
