mage-eventpress/inc/template-prts/event_loop_timeline.php

79 lines
4.2 KiB
PHP
Raw Permalink Normal View History

2020-04-08 14:30:01 -04:00
<?php
2020-05-24 04:17:41 -04:00
if (!defined('ABSPATH')) {
die;
} // Cannot access pages directly.
2020-04-08 14:30:01 -04:00
/**
* This is the templates of the event timeline view shortcode
*/
2020-07-12 06:42:13 -04:00
add_filter('mage_event_loop_list_shortcode', 'mep_event_loop_timeline_style', 10, 3);
2020-05-24 04:17:41 -04:00
if (!function_exists('mep_event_loop_timeline_style')) {
2020-07-12 06:42:13 -04:00
function mep_event_loop_timeline_style($content, $event_id, $style)
{
if ($style == 'timeline') {
$now = current_time('Y-m-d H:i:s');
2022-04-12 01:00:35 -04:00
$show_price = mep_get_option('mep_event_price_show', 'event_list_setting_sec', 'yes');
2021-12-13 07:12:54 -05:00
$price_count = mep_event_list_price($event_id, 'count');
$show_price_label = $price_count == 1 ? mep_get_option('event_price_label_single', 'general_setting_sec', __('Price:','mage-eventpress')) : mep_get_option('event-price-label', 'general_setting_sec', __('Price Starts from:','mage-eventpress'));
2020-07-12 06:42:13 -04:00
$event_meta = get_post_custom($event_id);
$author_terms = get_the_terms($event_id, 'mep_org');
$time = strtotime($event_meta['event_start_date'][0] . ' ' . $event_meta['event_start_time'][0]);
$newformat = date_i18n('Y-m-d H:i:s', $time);
$tt = get_the_terms($event_id, 'mep_cat');
$torg = get_the_terms($event_id, 'mep_org');
$org_class = mep_get_term_as_class($event_id, 'mep_org');
$cat_class = mep_get_term_as_class($event_id, 'mep_cat');
$event_multidate = array_key_exists('mep_event_more_date', $event_meta) ? maybe_unserialize($event_meta['mep_event_more_date'][0]) : array();
$available_seat = mep_get_total_available_seat($event_id, $event_meta);
2022-04-12 01:00:35 -04:00
$hide_org_list = mep_get_option('mep_event_hide_organizer_list', 'event_list_setting_sec', 'no');
$hide_location_list = mep_get_option('mep_event_hide_location_list', 'event_list_setting_sec', 'no');
$hide_time_list = mep_get_option('mep_event_hide_time_list', 'event_list_setting_sec', 'no');
$hide_only_end_time_list = mep_get_option('mep_event_hide_end_time_list', 'event_list_setting_sec', 'no');
2020-07-12 06:42:13 -04:00
$recurring = get_post_meta($event_id, 'mep_enable_recurring', true) ? get_post_meta($event_id, 'mep_enable_recurring', true) : 'no';
$start_datetime = $event_meta['event_start_date'][0];
$end_datetime = $event_meta['event_end_date'][0];
ob_start();
require(mep_template_file_path('list/timeline.php'));
$content = ob_get_clean();
return $content;
} else {
return $content;
}
2020-04-08 14:30:01 -04:00
}
}
2020-07-12 06:42:13 -04:00
add_action('mep_event_shortcode_js_script', 'mep_shortcode_timeline_js_script');
2020-05-24 04:17:41 -04:00
if (!function_exists('mep_shortcode_timeline_js_script')) {
2020-07-12 06:42:13 -04:00
function mep_shortcode_timeline_js_script($params)
{
$cat = $params['cat'];
$org = $params['org'];
$style = $params['style'];
$cat_f = $params['cat-filter'];
$org_f = $params['org-filter'];
$show = $params['show'];
$pagination = $params['pagination'];
$sort = $params['sort'];
$column = $style != 'grid' ? 1 : $params['column'];
$nav = $params['carousal-nav'] == 'yes' ? 1 : 0;
$dot = $params['carousal-dots'] == 'yes' ? 1 : 0;
$city = $params['city'];
$country = $params['country'];
$cid = $params['carousal-id'];
$tmode = $params['timeline-mode'];
$main_div = $pagination == 'carousal' ? '<div class="mage_grid_box owl-theme owl-carousel" id="mep-carousel' . $cid . '">' : '<div class="mage_grid_box">';
ob_start();
if ($style == 'timeline') {
?>
2020-04-08 14:30:01 -04:00
2020-07-12 06:42:13 -04:00
jQuery('.timeline').timeline({
2021-10-31 07:01:04 -04:00
mode: '<?php echo esc_attr($tmode); ?>',
2020-07-12 06:42:13 -04:00
visibleItems: 4
});
<?php
}
echo ob_get_clean();
2020-04-08 14:30:01 -04:00
}
}