/** * Display for Event Custom Post Types */ if (!defined('ABSPATH')) { die('-1'); } global $post; global $wp; global $ecwd_options; global $wp_query; $json_ld = array( '@context' => 'https://schema.org', '@type' => 'Event', 'name' => $post->post_title, 'description' => strip_tags(preg_replace('/\\r|\\n|(\[(.*)\])/i', "", $post->post_content)), 'image' => get_the_post_thumbnail_url($post->ID), 'eventAttendanceMode' => 'https://schema.org/MixedEventAttendanceMode', 'eventStatus' => 'https://schema.org/EventScheduled' ); if ( !empty($args['organizers']) ) { foreach ( $args['organizers'] as $organizer ) { $data['performer'][] = array( '@type' => 'Person', 'name' => $organizer['name'], 'description' => '', 'telephone' => '', 'sameAs' => '', ); } } $post_id = $post->ID; $meta = get_post_meta($post_id); $date_format = 'Y-m-d'; $time_format = 'H:i'; $ecwd_social_icons = false; if (isset($ecwd_options['date_format']) && $ecwd_options['date_format'] != '') { $date_format = $ecwd_options['date_format']; } if (isset($ecwd_options['time_format']) && $ecwd_options['time_format'] != '') { $time_format = $ecwd_options['time_format']; } $time_format .= (isset($ecwd_options['time_type']) ? ' ' . $ecwd_options['time_type'] : ''); if (isset($ecwd_options['time_type']) && $ecwd_options['time_type'] != '') { $time_format = str_replace('H', 'g', $time_format); $time_format = str_replace('h', 'g', $time_format); } if (isset($ecwd_options['social_icons']) && $ecwd_options['social_icons'] != '') { $ecwd_social_icons = $ecwd_options['social_icons']; } // Load up all post meta data $ecwd_event = $post; $ecwd_event_metas = get_post_meta($ecwd_event->ID, '', true); if(isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'][0])) { $ecwd_event_date_from = $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'][0]; $ecwd_event_date_to = $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'][0]; $is_default_dates = false; }else{ $today = ECWD::ecwd_date('Y-m-d H:i'); $ecwd_event_date_from = ECWD::ecwd_date('Y/m/d H:i', strtotime($today . "+1 days")); $ecwd_event_date_to = ECWD::ecwd_date('Y/m/d H:i', strtotime($ecwd_event_date_from . "+1 hour")); $is_default_dates = true; } if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'])) { $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'] = array(0 => ''); } if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'])) { $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'] = array(0 => ''); } if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_lat_long'])) { $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_lat_long'] = array(0 => ''); } if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'])) { $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'] = array(0 => ''); } if (!isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'])) { $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'] = array(0 => ''); } $permalink = get_the_permalink($ecwd_event->ID); $this_event = $events[$ecwd_event->ID] = new ECWD_Event($ecwd_event->ID, '', $ecwd_event->post_title, $ecwd_event->post_content, $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_lat_long'][0], $permalink, $ecwd_event, '', $ecwd_event_metas); $d = new ECWD_Display(''); if (isset($_GET['eventDate']) || isset($wp_query->query_vars['eventDate'])) { $start_time = ECWD::ecwd_date('H:i', strtotime($ecwd_event_date_from)); $end_time = ECWD::ecwd_date('H:i', strtotime($ecwd_event_date_to)); $ecwd_event_date_from = isset($_GET['eventDate']) ? sanitize_text_field($_GET['eventDate']) : $wp_query->query_vars['eventDate']; $eventdayslong = $d->dateDiff($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_from'][0], $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_date_to'][0]); $ecwd_event_date_to = ECWD::ecwd_date('Y-m-d', strtotime((ECWD::ecwd_date("Y-m-d", (strtotime($ecwd_event_date_from))) . " +" . ($eventdayslong) . " days"))); $ecwd_event_date_from .= ' ' . $start_time; $ecwd_event_date_to .= ' ' . $end_time; } $ecwd_event_location = isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'][0]) ? $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_location'][0] : ''; $ecwd_event_latlong = isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_lat_long'][0]) ? $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_lat_long'][0] : ''; //$ecwd_event_zoom = isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_map_zoom'][0]) ? $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_map_zoom'][0] : ''; $ecwd_event_show_map = isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_show_map'][0]) ? $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_show_map'][0] : 0; if ($ecwd_event_show_map == '') { $ecwd_event_show_map = 1; } $ecwd_event_organizers = isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_organizers'][0]) ? $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_organizers'][0] : ''; $ecwd_event_url = isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'][0]) ? $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_url'][0] : ''; $ecwd_event_url = ECWD::add_http($ecwd_event_url); $ecwd_event_video = isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_video'][0]) ? $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_video'][0] : ''; $ecwd_all_day_event = isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_all_day_event'][0]) ? $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_all_day_event'][0] : 0; $venue = ''; $venue_permalink = ''; $venue_post_id = isset($ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_venue'][0]) ? $ecwd_event_metas[ECWD_PLUGIN_PREFIX . '_event_venue'][0] : 0; if ($venue_post_id) { $venue_post = get_post($venue_post_id); if ($venue_post) { $venue = $venue_post->post_title; $venue_permalink = get_permalink($venue_post->ID); } } $venue_meta_template = '
%s:%s
'; $venue_meta_link_template = '
%s:%s
'; if (is_numeric($venue_post_id)) { $ecwd_venue_phone = esc_html(get_post_meta($venue_post_id, 'ecwd_venue_meta_phone', true)); $ecwd_venue_website = esc_url(get_post_meta($venue_post_id, 'ecwd_venue_meta_website', true)); $ecwd_event_zoom = esc_html(get_post_meta($venue_post_id, 'ecwd_map_zoom', true)); $ecwd_venue_website = ECWD::add_http($ecwd_venue_website); } else { $ecwd_venue_phone = ""; $ecwd_venue_website = ""; $ecwd_event_zoom = ""; } if (!$ecwd_event_zoom) { $ecwd_event_zoom = (isset($ecwd_options['gmap_zoom'])) ? $ecwd_options['gmap_zoom'] : 17; } $organizers = array(); $ecwd_event_organizers = maybe_unserialize($ecwd_event_organizers); if (is_array($ecwd_event_organizers) || is_object($ecwd_event_organizers)) { foreach ($ecwd_event_organizers as $ecwd_event_organizer) { $temp = get_post($ecwd_event_organizer, ARRAY_A); if ($temp !== null) { $organizers[] = $temp; } } } $category_and_tags = false; if (isset($ecwd_options['category_and_tags']) && $ecwd_options['category_and_tags'] != '') { $category_and_tags = $ecwd_options['category_and_tags']; } $args = array('orderby' => 'name', 'order' => 'ASC', 'fields' => 'all'); $event_tags = wp_get_post_terms($post->ID, 'ecwd_event_tag', $args); $event_categories = wp_get_post_terms($post->ID, 'ecwd_event_category', $args); $default_calendar = get_option('ecwd_default_calendar'); $calendars_id = get_post_meta($post_id, 'ecwd_event_calendars', true); $back_link = null; $back_link_text = __('View Calendar', 'event-calendar-wd'); if (!empty($calendars_id)) { if ($default_calendar !== false && in_array($default_calendar, $calendars_id)) { $back_link = get_permalink($default_calendar); } else { $back_link = get_permalink(array_shift($calendars_id)); } } else { if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']) { if (parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST) == parse_url(site_url(), PHP_URL_HOST)) { $back_link = $_SERVER['HTTP_REFERER']; $back_link_text = __('Back', 'event-calendar-wd'); } } } ?>
December 4, 2022 8:32 AM - 8:32 AM