From 298ea0c557f178a48f6b0cb0e05f40abe1ffd336 Mon Sep 17 00:00:00 2001 From: magepeopleteam Date: Mon, 4 Oct 2021 04:55:36 +0000 Subject: [PATCH] function update --- inc/mep_functions.php | 44 +++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/inc/mep_functions.php b/inc/mep_functions.php index aed0727..235ccf9 100755 --- a/inc/mep_functions.php +++ b/inc/mep_functions.php @@ -1610,18 +1610,38 @@ if (!function_exists('mep_get_only_time')) { } if (!function_exists('mep_get_event_city')) { - function mep_get_event_city($id){ - $location_sts = get_post_meta($id,'mep_org_address',true); - $event_meta = get_post_custom($id); - if($location_sts){ - $org_arr = get_the_terms( $id, 'mep_org' ); - if(is_array($org_arr) && sizeof($org_arr) > 0 ){ - $org_id = $org_arr[0]->term_id; - echo "".mep_ev_venue($id).' '.get_term_meta( $org_id, 'org_city', true ).""; - } - }else{ - echo "".mep_ev_venue($id).' '.$event_meta['mep_city'][0].""; - } + function mep_get_event_city($event_id){ + $location_sts = get_post_meta($event_id, 'mep_org_address', true) ? get_post_meta($event_id, 'mep_org_address', true) : ''; + ob_start(); + if ($location_sts) { + $org_arr = get_the_terms($event_id, 'mep_org'); + $org_id = $org_arr[0]->term_id; + $location = get_term_meta($org_id, 'org_location', true) ? get_term_meta($org_id, 'org_location', true) : ''; + $street = get_term_meta($org_id, 'org_street', true) ? get_term_meta($org_id, 'org_street', true) : ''; + $city = get_term_meta($org_id, 'org_city', true) ? get_term_meta($org_id, 'org_city', true) : ''; + $state = get_term_meta($org_id, 'org_state', true) ? get_term_meta($org_id, 'org_state', true) : ''; + $zip = get_term_meta($org_id, 'org_postcode', true) ? get_term_meta($org_id, 'org_postcode', true) : ''; + $country = get_term_meta($org_id, 'org_country', true) ? get_term_meta($org_id, 'org_country', true) : ''; + } else { + $location = get_post_meta($event_id, 'mep_location_venue', true) ? get_post_meta($event_id, 'mep_location_venue', true) : ''; + $street = get_post_meta($event_id, 'mep_street', true) ? get_post_meta($event_id, 'mep_street', true) : ''; + $city = get_post_meta($event_id, 'mep_city', true) ? get_post_meta($event_id, 'mep_city', true) : ''; + $state = get_post_meta($event_id, 'mep_state', true) ? get_post_meta($event_id, 'mep_state', true) : ''; + $zip = get_post_meta($event_id, 'mep_postcode', true) ? get_post_meta($event_id, 'mep_postcode', true) : ''; + $country = get_post_meta($event_id, 'mep_country', true) ? get_post_meta($event_id, 'mep_country', true) : ''; + } + + $location_arr = [$location, $city]; + $content = implode(', ', array_filter($location_arr)); + $address_arr = array( + 'location' => $location, + 'street' => $street, + 'state' => $state, + 'zip' => $zip, + 'city' => $city, + 'country' => $country + ); + echo apply_filters('mage_event_location_in_list_view', $content, $event_id, $address_arr); } }