mage-eventpress/inc/mep_shortcode.php

527 lines
20 KiB
PHP
Raw Normal View History

<?php
2020-01-22 07:15:24 -05:00
if (!defined('ABSPATH')) {
die;
} // Cannot access pages directly.
2018-07-02 04:39:41 -04:00
2020-04-28 06:37:33 -04:00
/**
* This is the Shortcode For Display The City List of The Event
*/
2020-04-08 14:30:01 -04:00
add_shortcode('event-city-list', 'mep_event_city_list_shortcode_func');
2020-04-28 06:37:33 -04:00
function mep_event_city_list_shortcode_func($atts, $content = null)
{
2020-04-08 14:30:01 -04:00
ob_start();
2020-04-28 06:37:33 -04:00
echo mep_event_get_event_city_list();
2020-04-08 14:30:01 -04:00
return ob_get_clean();
}
2020-04-28 06:37:33 -04:00
/**
* This is the Shortcode For Display Event Calendar
*/
2020-01-22 07:15:24 -05:00
add_shortcode('event-calendar', 'mep_cal_func');
2020-04-28 06:37:33 -04:00
function mep_cal_func($atts, $content = null)
{
2019-10-07 00:39:24 -04:00
ob_start();
2020-01-22 07:15:24 -05:00
echo mep_event_calender();
2019-10-07 00:39:24 -04:00
return ob_get_clean();
}
2020-04-28 06:37:33 -04:00
function mep_event_calender()
{
2020-03-19 08:34:31 -04:00
?>
2020-01-22 07:15:24 -05:00
<div class="event-calendar"></div>
<script>
2020-04-28 06:37:33 -04:00
jQuery(document).ready(function() {
2020-01-22 07:15:24 -05:00
const myEvents = [
<?php
2020-04-10 16:08:35 -04:00
// $loop = mep_event_query('all',-1);
2020-04-28 06:37:33 -04:00
$args = array(
2020-04-10 16:08:35 -04:00
'post_type' => array('mep_events'),
'posts_per_page' => -1,
'order' => 'ASC',
'orderby' => 'meta_value',
'meta_key' => 'event_start_datetime'
2020-04-28 06:37:33 -04:00
);
$loop = new WP_Query($args);
2020-03-19 08:34:31 -04:00
$i = 1;
$count = $loop->post_count - 1;
2020-01-22 07:15:24 -05:00
while ($loop->have_posts()) {
2020-04-28 06:37:33 -04:00
$loop->the_post();
$event_meta = get_post_custom(get_the_id());
2020-08-05 08:06:45 -04:00
$event_dates = mep_get_event_dates_arr(get_the_id());
foreach ($event_dates as $_dates) {
?>
{
start: '<?php echo date_i18n('Y-m-d H:i', strtotime($_dates['start'])); ?>',
end: '<?php echo date_i18n('Y-m-d H:i', strtotime($_dates['end'])); ?>',
2020-04-28 06:37:33 -04:00
title: '<?php the_title(); ?>',
url: '<?php the_permalink(); ?>',
class: '',
color: '#000',
data: {}
},
2020-08-05 08:06:45 -04:00
<?php
}
2020-04-28 06:37:33 -04:00
}
$i++;
2020-08-05 08:06:45 -04:00
2020-04-28 06:37:33 -04:00
wp_reset_postdata(); ?>
]
2020-01-22 07:15:24 -05:00
jQuery('.event-calendar').equinox({
events: myEvents
});
});
</script>
2020-04-28 06:37:33 -04:00
<?php
2018-07-02 04:39:41 -04:00
}
2021-01-07 04:57:54 -05:00
/**
2020-04-28 06:37:33 -04:00
* The Magical & The Main Event Listing Shortcode is Here, You can check the details with demo here https://wordpress.org/plugins/mage-eventpress/
*/
2020-01-22 07:15:24 -05:00
add_shortcode('event-list', 'mep_event_list');
2020-04-28 06:37:33 -04:00
function mep_event_list($atts, $content = null)
{
2020-01-22 07:15:24 -05:00
$defaults = array(
2020-04-08 14:30:01 -04:00
"cat" => "0",
"org" => "0",
"style" => "grid",
"column" => 3,
"cat-filter" => "no",
"org-filter" => "no",
"show" => "-1",
"pagination" => "no",
"city" => "",
"country" => "",
"carousal-nav" => "no",
"carousal-dots" => "yes",
"carousal-id" => "102448",
"timeline-mode" => "vertical",
2020-04-28 06:37:33 -04:00
'sort' => 'ASC',
'status' => 'upcoming'
2020-01-22 07:15:24 -05:00
);
2020-02-05 07:47:07 -05:00
$params = shortcode_atts($defaults, $atts);
$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'];
2020-04-08 14:30:01 -04:00
$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'];
2020-04-28 06:37:33 -04:00
$status = $params['status'];
$main_div = $pagination == 'carousal' ? '<div class="mage_grid_box owl-theme owl-carousel" id="mep-carousel' . $cid . '">' : '<div class="mage_grid_box">';
2020-04-08 14:30:01 -04:00
$time_line_div_start = $style == 'timeline' ? '<div class="timeline"><div class="timeline__wrap"><div class="timeline__items">' : '';
$time_line_div_end = $style == 'timeline' ? '</div></div></div>' : '';
2020-04-28 06:37:33 -04:00
2020-02-05 07:47:07 -05:00
$flex_column = $column;
2020-01-22 07:15:24 -05:00
$mage_div_count = 0;
$event_expire_on = mep_get_option('mep_event_expire_on_datetimes', 'general_setting_sec', 'event_start_datetime');
2020-10-26 07:41:46 -04:00
$unq_id = 'abr'.uniqid();
2020-01-22 07:15:24 -05:00
ob_start();
2020-04-28 06:37:33 -04:00
?>
2020-01-22 07:15:24 -05:00
<div class='mep_event_list'>
2020-04-28 06:37:33 -04:00
<?php if ($cat_f == 'yes') {
2020-03-19 08:34:31 -04:00
/**
* This is the hook where category filter lists are fired from inc/template-parts/event_list_tax_name_list.php File
*/
2020-10-26 07:41:46 -04:00
do_action('mep_event_list_cat_names',$cat,$unq_id);
2020-04-28 06:37:33 -04:00
}
if ($org_f == 'yes') {
2020-03-19 08:34:31 -04:00
/**
* This is the hook where Organization filter lists are fired from inc/template-parts/event_list_tax_name_list.php File
*/
2020-10-26 07:41:46 -04:00
do_action('mep_event_list_org_names',$org,$unq_id);
2020-04-28 06:37:33 -04:00
} ?>
2020-01-22 07:15:24 -05:00
2020-10-26 07:41:46 -04:00
<div class="mep_event_list_secxx" id='mep_event_list_<?php echo $unq_id; ?>'>
2020-01-22 07:15:24 -05:00
<?php
2020-04-28 06:37:33 -04:00
/**
2020-03-19 08:34:31 -04:00
* The Main Query function mep_event_query is locet in inc/mep_query.php File
2021-01-07 04:57:54 -05:00
*/
2020-04-28 06:37:33 -04:00
$loop = mep_event_query($show, $sort, $cat, $org, $city, $country, $status);
$total_post = $loop->post_count;
2020-04-08 14:30:01 -04:00
echo $main_div;
echo $time_line_div_start;
2020-01-22 07:15:24 -05:00
while ($loop->have_posts()) {
2020-04-28 06:37:33 -04:00
$loop->the_post();
2020-11-07 23:58:37 -05:00
if ($style == 'grid' && (int)$column>0 && $pagination != 'carousal') {
2020-10-28 00:38:49 -04:00
$columnNumber='column_style';
$width=100/(int)$column;
2020-11-07 23:58:37 -05:00
}elseif($pagination == 'carousal' && $style == 'grid'){
$columnNumber = 'grid';
$width=100;
2020-01-22 07:15:24 -05:00
} else {
$columnNumber = 'one_column';
2020-10-28 00:38:49 -04:00
$width=100;
2020-01-22 07:15:24 -05:00
}
2020-11-07 23:58:37 -05:00
2020-03-19 08:34:31 -04:00
/**
* This is the hook where Event Loop List fired from inc/template-parts/event_loop_list.php File
*/
2020-10-26 07:41:46 -04:00
2020-10-28 00:38:49 -04:00
do_action('mep_event_list_shortcode', get_the_id(), $columnNumber, $style,$width,$unq_id);
2020-01-22 07:15:24 -05:00
}
wp_reset_postdata();
2020-04-08 14:30:01 -04:00
echo $time_line_div_end;
2020-04-28 06:37:33 -04:00
if ($pagination == 'yes') {
/**
* The Pagination function mep_event_pagination is locet in inc/mep_query.php File
*/
mep_event_pagination($loop->max_num_pages);
2020-03-19 08:34:31 -04:00
} ?>
2020-04-28 06:37:33 -04:00
2020-01-22 07:15:24 -05:00
</div>
</div>
2020-04-28 06:37:33 -04:00
</div>
2020-01-22 07:15:24 -05:00
<script>
2020-04-28 06:37:33 -04:00
jQuery(document).ready(function() {
2020-10-26 07:41:46 -04:00
var containerEl = document.querySelector('#mep_event_list_<?php echo $unq_id; ?>');
2018-10-31 05:30:00 -04:00
var mixer = mixitup(containerEl);
2020-10-26 07:41:46 -04:00
2020-04-28 06:37:33 -04:00
<?php if ($pagination == 'carousal') { ?>
jQuery('#mep-carousel<?php echo $cid; ?>').owlCarousel({
2020-08-05 08:06:45 -04:00
autoplay: <?php echo mep_get_option('mep_autoplay_carousal', 'carousel_setting_sec', 'true'); ?>,
autoplayTimeout:<?php echo mep_get_option('mep_speed_carousal', 'carousel_setting_sec', '5000'); ?>,
2020-04-28 06:37:33 -04:00
autoplayHoverPause: true,
2020-08-05 08:06:45 -04:00
loop: <?php echo mep_get_option('mep_loop_carousal', 'carousel_setting_sec', 'true'); ?>,
2020-04-28 06:37:33 -04:00
margin: 20,
nav: <?php echo $nav; ?>,
dots: <?php echo $dot; ?>,
responsiveClass: true,
responsive: {
0: {
items: 1,
},
600: {
items: 2,
},
1000: {
items: <?php echo $column; ?>,
}
2020-04-08 14:30:01 -04:00
}
2020-04-28 06:37:33 -04:00
});
2020-04-08 14:30:01 -04:00
<?php } ?>
2020-04-28 06:37:33 -04:00
<?php do_action('mep_event_shortcode_js_script', $params); ?>
2020-01-22 07:15:24 -05:00
});
</script>
2020-04-28 06:37:33 -04:00
<?php
2020-01-22 07:15:24 -05:00
$content = ob_get_clean();
return $content;
2018-10-31 05:30:00 -04:00
}
2020-03-19 08:34:31 -04:00
2020-04-28 06:37:33 -04:00
/**
* This Is a Shortcode for display Expired Events, This will be depriciated in the version 4.0, because we added this feature into the main shortcode [event-list]. Just use [event-list status="expired"]
*/
2020-01-22 07:15:24 -05:00
add_shortcode('expire-event-list', 'mep_expire_event_list');
function mep_expire_event_list($atts, $content = null)
{
$defaults = array(
2020-04-28 06:37:33 -04:00
"cat" => "0",
"org" => "0",
"style" => "grid",
"column" => 3,
"cat-filter" => "no",
"org-filter" => "no",
"show" => "-1",
"pagination" => "no",
"city" => "",
"country" => "",
"carousal-nav" => "no",
"carousal-dots" => "yes",
"carousal-id" => "102448",
"timeline-mode" => "vertical",
'sort' => 'ASC'
2020-01-22 07:15:24 -05:00
);
2021-03-15 08:01:19 -04:00
2020-04-28 06:37:33 -04:00
$params = shortcode_atts($defaults, $atts);
$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'];
$main_div = $pagination == 'carousal' ? '<div class="mage_grid_box owl-theme owl-carousel" id="mep-carousel' . $cid . '">' : '<div class="mage_grid_box">';
2020-01-22 07:15:24 -05:00
2020-04-28 06:37:33 -04:00
$time_line_div_start = $style == 'timeline' ? '<div class="timeline"><div class="timeline__wrap"><div class="timeline__items">' : '';
$time_line_div_end = $style == 'timeline' ? '</div></div></div>' : '';
$flex_column = $column;
$mage_div_count = 0;
$event_expire_on = mep_get_option('mep_event_expire_on_datetimes', 'general_setting_sec', 'event_start_datetime');
2020-01-22 07:15:24 -05:00
ob_start();
2020-04-28 06:37:33 -04:00
?>
2020-01-22 07:15:24 -05:00
<div class='mep_event_list'>
2020-04-28 06:37:33 -04:00
<?php if ($cat_f == 'yes') {
2020-03-19 08:34:31 -04:00
/**
* This is the hook where category filter lists are fired from inc/template-parts/event_list_tax_name_list.php File
*/
2020-09-14 00:50:46 -04:00
do_action('mep_event_list_cat_names',$cat);
2020-03-19 08:34:31 -04:00
}
2020-04-28 06:37:33 -04:00
if ($org_f == 'yes') {
2020-03-19 08:34:31 -04:00
/**
* This is the hook where Organization filter lists are fired from inc/template-parts/event_list_tax_name_list.php File
*/
2020-09-14 00:50:46 -04:00
do_action('mep_event_list_org_names',$org);
2020-03-19 08:34:31 -04:00
} ?>
2020-04-28 06:37:33 -04:00
<div class="mep_event_list_sec">
2020-01-22 07:15:24 -05:00
<?php
2020-04-28 06:37:33 -04:00
/**
2020-03-19 08:34:31 -04:00
* The Main Query function mep_event_query is locet in inc/mep_query.php File
2020-04-28 06:37:33 -04:00
*/
$loop = mep_event_query($show, $sort, $cat, $org, $city, $country, 'expired');
$total_post = $loop->post_count;
2020-03-19 08:34:31 -04:00
echo '<div class="mage_grid_box">';
2020-01-22 07:15:24 -05:00
while ($loop->have_posts()) {
2020-04-28 06:37:33 -04:00
$loop->the_post();
2020-10-28 00:38:49 -04:00
if ($style == 'grid' && (int)$column>0) {
$columnNumber='column_style';
$width=100/(int)$column;
} else {
$columnNumber = 'one_column';
$width=100;
}
2020-03-19 08:34:31 -04:00
/**
* This is the hook where Event Loop List fired from inc/template-parts/event_loop_list.php File
*/
2020-10-28 00:38:49 -04:00
do_action('mep_event_list_shortcode', get_the_id(), $columnNumber, $style,$width);
2020-01-22 07:15:24 -05:00
}
wp_reset_postdata();
2020-03-19 08:34:31 -04:00
echo '</div>';
2020-04-28 06:37:33 -04:00
if ($pagination == 'yes') {
/**
* The Pagination function mep_event_pagination is locet in inc/mep_query.php File
*/
mep_event_pagination($loop->max_num_pages);
2020-03-19 08:34:31 -04:00
} ?>
2020-01-22 07:15:24 -05:00
</div>
</div>
<script>
2020-04-28 06:37:33 -04:00
jQuery(document).ready(function() {
2018-08-10 12:12:04 -04:00
var containerEl = document.querySelector('.mep_event_list_sec');
var mixer = mixitup(containerEl);
2020-01-22 07:15:24 -05:00
});
</script>
2020-04-28 06:37:33 -04:00
<?php
2020-01-22 07:15:24 -05:00
$content = ob_get_clean();
return $content;
}
2020-04-28 06:37:33 -04:00
add_shortcode('event-add-cart-section', 'mep_event_add_to_cart_section');
function mep_event_add_to_cart_section($atts, $content = null)
{
$defaults = array(
"event" => "0"
);
$params = shortcode_atts($defaults, $atts);
$event = $params['event'];
ob_start();
if($event > 0){
2021-02-25 06:55:25 -05:00
echo mep_shortcode_add_cart_section_html($event);
do_action('mep_after_event_cart_shortcode',$event);
2020-04-28 06:37:33 -04:00
}
return ob_get_clean();
}
add_shortcode('event-speaker-list', 'mep_event_speaker_list_shortcode_section');
function mep_event_speaker_list_shortcode_section($atts, $content = null)
{
$defaults = array(
"event" => "0"
);
$params = shortcode_atts($defaults, $atts);
$event = $params['event'];
ob_start();
if($event > 0){
echo mep_shortcode_speaker_list_html($event);
2020-07-20 06:01:44 -04:00
}else{
echo mep_shortcode_all_speaker_list_html();
2020-04-28 06:37:33 -04:00
}
return ob_get_clean();
}
2020-01-22 07:15:24 -05:00
add_shortcode('event-list-onepage', 'mep_event_onepage_list');
function mep_event_onepage_list($atts, $content = null)
{
$defaults = array(
2020-09-14 00:50:46 -04:00
"cat" => "0",
"org" => "0",
"style" => "grid",
"column" => 3,
"cat-filter" => "no",
"org-filter" => "no",
"show" => "-1",
"pagination" => "no",
"city" => "",
"country" => "",
"carousal-nav" => "no",
"carousal-dots" => "yes",
"carousal-id" => "102448",
"timeline-mode" => "vertical",
'sort' => 'ASC',
'status' => 'upcoming'
2020-01-22 07:15:24 -05:00
);
2020-09-14 00:50:46 -04:00
$params = shortcode_atts($defaults, $atts);
$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'];
$status = $params['status'];
$main_div = $pagination == 'carousal' ? '<div class="mage_grid_box owl-theme owl-carousel" id="mep-carousel' . $cid . '">' : '<div class="mage_grid_box">';
2020-01-22 07:15:24 -05:00
2020-09-14 00:50:46 -04:00
$time_line_div_start = $style == 'timeline' ? '<div class="timeline"><div class="timeline__wrap"><div class="timeline__items">' : '';
$time_line_div_end = $style == 'timeline' ? '</div></div></div>' : '';
$flex_column = $column;
$mage_div_count = 0;
$event_expire_on = mep_get_option('mep_event_expire_on_datetimes', 'general_setting_sec', 'event_start_datetime');
ob_start();
2020-01-22 07:15:24 -05:00
do_action('woocommerce_before_single_product');
2020-04-28 06:37:33 -04:00
?>
2020-01-22 07:15:24 -05:00
<div class='mep_event_list'>
2020-04-28 06:37:33 -04:00
<?php if ($cat_f == 'yes') {
2020-03-19 08:34:31 -04:00
/**
* This is the hook where category filter lists are fired from inc/template-parts/event_list_tax_name_list.php File
*/
2020-09-14 00:50:46 -04:00
do_action('mep_event_list_cat_names',$cat);
2020-04-28 06:37:33 -04:00
}
if ($org_f == 'yes') {
2020-03-19 08:34:31 -04:00
/**
* This is the hook where Organization filter lists are fired from inc/template-parts/event_list_tax_name_list.php File
*/
2020-09-14 00:50:46 -04:00
do_action('mep_event_list_org_names',$org);
2020-04-28 06:37:33 -04:00
} ?>
2020-01-22 07:15:24 -05:00
<div class="mep_event_list_sec">
<?php
2020-03-19 08:34:31 -04:00
$now = current_time('Y-m-d H:i:s');
$show_price = mep_get_option('mep_event_price_show', 'general_setting_sec', 'yes');
$show_price_label = mep_get_option('event-price-label', 'general_setting_sec', 'Price Starts from:');
$paged = get_query_var("paged") ? get_query_var("paged") : 1;
2020-04-28 06:37:33 -04:00
2020-09-14 00:50:46 -04:00
2020-04-28 06:37:33 -04:00
?>
<div class="mep_event_list_sec">
<?php
2020-09-14 00:50:46 -04:00
2020-04-28 06:37:33 -04:00
/**
* The Main Query function mep_event_query is locet in inc/mep_query.php File
*/
2020-09-14 00:50:46 -04:00
$loop = mep_event_query($show, $sort, $cat, $org, $city, $country, $status);
2020-01-22 07:15:24 -05:00
$loop->the_post();
2020-09-14 00:50:46 -04:00
2020-03-19 08:34:31 -04:00
$event_meta = get_post_custom(get_the_id());
$author_terms = get_the_terms(get_the_id(), 'mep_org');
$start_datetime = $event_meta['event_start_date'][0] . ' ' . $event_meta['event_start_time'][0];
2020-01-22 07:15:24 -05:00
$time = strtotime($start_datetime);
$newformat = date_i18n('Y-m-d H:i:s', $time);
$tt = get_the_terms(get_the_id(), 'mep_cat');
$torg = get_the_terms(get_the_id(), 'mep_org');
$org_class = mep_get_term_as_class(get_the_id(), 'mep_org');
$cat_class = mep_get_term_as_class(get_the_id(), 'mep_cat');
2020-04-28 06:37:33 -04:00
$available_seat = mep_get_total_available_seat(get_the_id(), $event_meta);
echo '<div class="mage_grid_box">';
while ($loop->have_posts()) {
$loop->the_post();
2020-10-28 00:38:49 -04:00
if ($style == 'grid' && (int)$column>0) {
$columnNumber='column_style';
$width=100/(int)$column;
} else {
$columnNumber = 'one_column';
$width=100;
}
2020-04-28 06:37:33 -04:00
/**
* This is the hook where Event Loop List fired from inc/template-parts/event_loop_list.php File
*/
2020-10-28 00:38:49 -04:00
do_action('mep_event_list_shortcode', get_the_id(), $columnNumber, $style,$width);
2020-04-28 06:37:33 -04:00
$currency_pos = get_option('woocommerce_currency_pos');
$mep_full_name = strip_tags($event_meta['mep_full_name'][0]);
$mep_reg_email = strip_tags($event_meta['mep_reg_email'][0]);
$mep_reg_phone = strip_tags($event_meta['mep_reg_phone'][0]);
$mep_reg_address = strip_tags($event_meta['mep_reg_address'][0]);
$mep_reg_designation = strip_tags($event_meta['mep_reg_designation'][0]);
$mep_reg_website = strip_tags($event_meta['mep_reg_website'][0]);
$mep_reg_veg = strip_tags($event_meta['mep_reg_veg'][0]);
$mep_reg_company = strip_tags($event_meta['mep_reg_company'][0]);
$mep_reg_gender = strip_tags($event_meta['mep_reg_gender'][0]);
$mep_reg_tshirtsize = strip_tags($event_meta['mep_reg_tshirtsize'][0]);
echo '<div class=event-cart-section-list>';
do_action('mep_add_to_cart_list');
echo '</div>';
get_event_list_js(get_the_id(), $event_meta, $currency_pos);
2020-03-19 08:34:31 -04:00
}
2020-04-28 06:37:33 -04:00
wp_reset_postdata();
echo '</div>';
if ($pagination == 'yes') {
/**
* The Pagination function mep_event_pagination is locet in inc/mep_query.php File
*/
mep_event_pagination($loop->max_num_pages);
} ?>
</div>
2020-01-22 07:15:24 -05:00
</div>
</div>
2020-04-28 06:37:33 -04:00
<?php
2020-01-22 07:15:24 -05:00
$content = ob_get_clean();
return $content;
2020-01-23 07:06:05 -05:00
}