John Bueno
Forum Replies Created
-
Please disregard my last post. I found the image url in the event object.
I managed to create my own even single page by grabbing the event slug from the end of my permalink and then using the wpdb function to get the corresponding event ID.
$url = $_SERVER['REQUEST_URI']; $eventSlug=end(explode("/", $url)); $eventID = $wpdb->get_results("SELECT event_id FROM wp_em_events WHERE event_slug = '".$eventSlug."'", OBJECT); $EM_Event = new EM_Event($eventID[0]->event_id);
One thing I am looking to do to finish up this up is to display the event image however I don’t see it being stored in the event object anywhere. Is it possible to get this url using something similar to.
<?php echo $EM_Event->get_categories()->categories[0]->name; ?>
Thanks again Marcus this has been very helpful. I have one last question and then I should be all set. I am attempting to use the:
$EM_Event = new EM_Event(id);
function which requires an event ID to generate a custom event single page. Is there some type of get event id function that I can use to get the id when I am on the single page. At this point my url is.
siteurl.com/events/event/event-name
Thanks again!
Thanks that is working for me. One last question. Is it possible to use:
EM_Events::get(array());
or something similar to create a custom single event page by passing it an argument that allows it only pull the single event?
Right now my code looks something like this:
if(em_is_events_page()){
if (class_exists(‘EM_Events’)) {
$events = EM_Events::get(array(‘scope’ => ‘future’, ‘town’=>$location, ‘category’=>$category ));foreach($events as $event) {
if(date(‘n’, $event->start) != $month) continue;
parse_event($event, ‘events’, $i);}
}
}else{
the_content();
}and I am just placing the code in the event single section of the plugin settings.
Hey Marcus
I am attempting to use the is_events_page() page to remove the events on the event single page however this function is throwing an error. Is it still supported? This is the method i am trying to use it in:
if(is_events_page()){
echo(‘true’);
}else{
echo(‘false’);
}With debug turned on I am getting an undefined function error.
I was previously using EM_Events::get() to echo get my events as an object. I recently updated to version 4 and for the most part my code is still working though EM_Events::get() no longer seems to get the category. This was my old code:
<div class=”location”>
<span class=”city”>’.$event->location->town.'</span>
<span class=”category’.$catclass.'”>’.$event->category->name.’ EM_Events::get()</span>
<span class=”title”>’.$event->name.'</span>
</div>’;thoughts?
Thanks!