Skip to content

Instantly share code, notes, and snippets.

@Basilakis
Created May 24, 2020 11:52
Show Gist options
  • Save Basilakis/0352a2fe8f23b42abd09e2cfb1077477 to your computer and use it in GitHub Desktop.
Save Basilakis/0352a2fe8f23b42abd09e2cfb1077477 to your computer and use it in GitHub Desktop.
Get eventsON Related Events Further Details for Locations
// Related Events @+2.8
case 'relatedEvents':
$events = $EVENT->get_prop('ev_releated');
$events = !empty($events)? json_decode($events, true): false;
if($events && is_array($events)){
ob_start();
?>
<div class='evo_metarow_rel_events evorow bordb evcal_evdata_row'>
<span class='evcal_evdata_icons'><i class='fa <?php echo get_eventON_icon('evcal__fai_relev', 'fa-cubes',$evOPT );?>'></i></span>
<div class='evcal_evdata_cell'>
<h3 class='evo_h3'><?php echo evo_lang('Related Events');?></h3>
<div class='evcal_cell_rel_events'>
<?php
foreach($events as $I=>$N){
$id = explode('-', $I);
$EE = new EVO_Event($id[0]);
$x = isset($id[1])? $id[1]:'0';
//stray defination
$location_lon = $location_lat = $location_address = $location_city = $location_state= $location_country = $evcal_location_link = $evo_loc_img = '';
$taxonomy = 'event_location';
$event_terms = wp_get_post_terms($id[0], $taxonomy);
if ( $event_terms && ! is_wp_error( $event_terms ) ){
$event_location_term = $event_terms[0];
$event_location_term_meta = evo_get_term_meta('event_location',$event_terms[0]->term_id);
$location_lon = $event_location_term_meta['location_lon'];
$location_lat = $event_location_term_meta['location_lat'];
$location_address = $event_location_term_meta['location_address'];
$location_city = $event_location_term_meta['location_city'];
$location_state = $event_location_term_meta['location_state'];
$location_country = $event_location_term_meta['location_country'];
$evcal_location_link = $event_location_term_meta['evcal_location_link'];
$evo_loc_img = $event_location_term_meta['evo_loc_img'];
}
$time = $EE->get_formatted_smart_time($x);
if ($location_address != ''):
$map = "<div style='width: 100%'>
<iframe width='100%' height='600' src='https://maps.google.com/maps?width=100%&amp;height=600&amp;hl=en&amp;q=.$location_address.&amp;ie=UTF8&amp;t=&amp;z=14&amp;iwloc=B&amp;output=embed' frameborder='0' scrolling='no' marginheight='0' marginwidth='0'>
</iframe></div><br />";
echo "<a href='". $EE->get_permalink($x). "'><em>{$time}</em><b>{$N}</b></a> . $map .";
echo $location_address;
endif;
}
?>
</div>
</div>
</div>
<?php
$OT.= ob_get_clean();
}
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment