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

63 lines
3.5 KiB
PHP
Raw Normal View History

2020-03-19 08:34:31 -04:00
<?php
2020-05-24 04:17:41 -04:00
if (!defined('ABSPATH')) {
die;
} // Cannot access pages directly.
2020-04-28 06:37:33 -04:00
2020-10-28 05:34:51 -04:00
add_action('mep_event_list_shortcode', 'mep_display_event_loop_list', 10, 5);
2020-05-24 04:17:41 -04:00
if (!function_exists('mep_display_event_loop_list')) {
2020-11-05 07:16:20 -05:00
function mep_display_event_loop_list($event_id, $columnNumber='', $style='',$width='', $unq_id ='')
2020-05-24 04:17:41 -04:00
{
$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');
// event_price_label_single
2022-06-27 00:31:32 -04:00
$show_price_label = $price_count == 1 ? mep_get_option('event_price_label_single', 'label_setting_sec', __('Price:','mage-eventpress')) : mep_get_option('event-price-label', 'label_setting_sec', __('Price Starts from:','mage-eventpress'));
2023-01-02 01:28:18 -05:00
2021-12-13 07:12:54 -05:00
2020-05-24 04:17:41 -04:00
$event_meta = get_post_custom($event_id);
$author_terms = get_the_terms($event_id, 'mep_org') ? 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');
2020-10-26 07:41:46 -04:00
$org_class = mep_get_term_as_class($event_id, 'mep_org',$unq_id);
$cat_class = mep_get_term_as_class($event_id, 'mep_cat',$unq_id);
2020-05-24 04:17:41 -04:00
$event_multidate = array_key_exists('mep_event_more_date', $event_meta) ? maybe_unserialize($event_meta['mep_event_more_date'][0]) : array();
2022-09-21 02:49:00 -04:00
$available_seat = apply_filters('mep_event_loop_list_available_seat', mep_get_total_available_seat($event_id, $event_meta), $event_id);
2022-10-31 22:09:15 -04:00
// $available_seat = 1;
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-05-24 04:17:41 -04:00
$recurring = get_post_meta($event_id, 'mep_enable_recurring', true) ? get_post_meta($event_id, 'mep_enable_recurring', true) : 'no';
2020-08-05 08:06:45 -04:00
$event_type = get_post_meta(get_the_id(), 'mep_event_type', true) ? get_post_meta(get_the_id(), 'mep_event_type', true) : 'offline';
2022-10-31 22:09:15 -04:00
// $post_id = get_the_id();
$total_seat = mep_event_total_seat($event_id, 'total');
$total_resv = mep_event_total_seat($event_id, 'resv');
$total_sold = mep_get_event_total_seat_left($event_id);
$_total_left = $total_seat - ($total_sold + $total_resv);
$total_left = apply_filters('mep_event_list_total_seat_count', $_total_left, $event_id);
$s = $total_left;
if($s > 0){
$class_name = 'event-availabe-seat';
}else{
$class_name = 'event-no-availabe-seat';
}
2020-05-24 04:17:41 -04:00
ob_start();
2022-10-31 22:09:15 -04:00
2022-09-21 02:49:00 -04:00
require(mep_template_file_path('list/default.php'));
2022-10-31 22:09:15 -04:00
do_action('mep_event_list_loop_end', $event_id);
?>
2020-05-24 04:17:41 -04:00
</div>
2020-07-12 06:42:13 -04:00
<?php
2020-05-24 04:17:41 -04:00
$content = ob_get_clean();
2020-10-26 07:41:46 -04:00
echo apply_filters('mage_event_loop_list_shortcode', $content, $event_id, $style, $unq_id);
2020-05-24 04:17:41 -04:00
}
2020-11-05 07:16:20 -05:00
}