sorry I’m afraid that we can’t help with custom coding 100% as per the support policy – http://eventsmanagerpro.com/support-policy/
Thread Starter
Ynasr
(@ynasr)
Hi,
I totally understand. That said, all I am trying to do is understand why events custom field are not accessible and why all the fixes you suggested aren’t working.
Many thanks,
Yvan
Thread Starter
Ynasr
(@ynasr)
Hi,
Is anyone able to assist me with this? I am really struggling to understand why querying events created by events-manager would be any different from querying any other custom posts. I am not looking for custom code, but for an explanation of why that is and ideas on how to solve this issue.
I am pretty sure this is something lots users are trying to achieve and so it’s probably worth addressing …
Many thanks,
Yvan
Thread Starter
Ynasr
(@ynasr)
Hi,
So i am now using the following code and here everything work.
<?php
$events = EM_Events::get(array( 'limit'=>10, 'owner' => 0, 'pagination'=>1));
foreach ( $events as $event ) {
echo $event->event_owner;
}
?>
The problem is that i then need to loop through events using <?php while ( $events->have_posts() ) : $events->the_post(); ?>
Can anyone help me out with this?
Many thanks,
yvan
Thread Starter
Ynasr
(@ynasr)
Hi Guys,
I finally got to the bottom of this. Used SQL to query wp_em_events though. I hope this helps folks that may be in a similar situation. FYI – I am a newbie so this is MOST CERTAINLY not best practice … but it works 🙂
global $wpdb;
$fivesdrafts = $wpdb->get_results(
"
SELECT wp_em_events.event_slug, wp_em_locations.location_latitude, wp_em_locations.location_longitude, wp_em_events.event_name, wp_em_events.event_start_time, wp_em_events.event_end_time, wp_em_events.event_start_date, wp_em_events.event_rsvp, wp_em_events.event_attributes, wp_terms.name
FROM wp_em_events
INNER JOIN wp_em_locations
ON wp_em_events.location_id=wp_em_locations.location_id
inner join wp_term_relationships
on wp_em_events.post_id = wp_term_relationships.object_id
inner join wp_term_taxonomy
on wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_id
inner join wp_terms
on wp_term_taxonomy.term_id = wp_terms.term_id
WHERE wp_em_events.event_start_date='$Dt'
AND wp_em_events.event_start_time='$fromSQL'
AND wp_em_events.event_end_time='$toSQL'
AND wp_terms.name = '$category'
", ARRAY_A
);
?>
Thanks again for the great plugin guys!
Best,
Yvan