This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('cmcal_ical_event', 'cmcal_ical_event_default_1_hour', 100, 3); | |
function cmcal_ical_event_default_1_hour($ical_event, $event_id, $calendar_id) { | |
// Event is NOT All Day | |
if (strpos($ical_event["DTSTART"], "T") !== false) { | |
$DTEND = DateTime::createFromFormat('Ymd\THis', $ical_event["DTEND"]); | |
$DTEND_time = $DTEND->format("His"); | |
//Hour is not set | |
if ($DTEND_time == "000000") { | |
$DTSTART = DateTime::createFromFormat('Ymd\THis', $ical_event["DTSTART"]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add shortcode for multiweeks calendar | |
*/ | |
add_shortcode('paramount_calendar_weeks', 'paramount_calendar_weeks_shortcode'); | |
function paramount_calendar_weeks_shortcode($atts) { | |
$studio_id = $atts["studio-id"]; | |
// if (empty($studio_id)) { | |
// return ''; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('cmcal_calendar_posts_query', 'calendar_return_specific_category', 10, 2); | |
function calendar_return_specific_category($query_args, $calendar_id) { | |
// restrict this option for a specific calendar | |
if ($calendar_id == '128') { | |
// Show only posts created by author id -> 2 | |
$query_args["author__in"] = array( 2 ); | |
} | |
return $query_args; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('wp_enqueue_scripts', 'cmcal_events_same_time_reorder', 9999); | |
add_action('admin_enqueue_scripts', 'cmcal_events_same_time_reorder', 9999); | |
function cmcal_events_same_time_reorder() { | |
//128 is the calendar id | |
$output = 'document.addEventListener("DOMContentLoaded", function () { | |
var non_business_days = ["2020-06-08", "2020-06-10", "2020-07-22"]; | |
non_business_days.forEach(set_non_business_days); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('cmcal_event_data', 'cmcal_event_data_custom', 10, 3); | |
function cmcal_event_data_custom($data, $calendar_id, $id) { | |
if (current_user_can('edit_posts')) { // only show the options to users that can edit the post | |
if ($calendar_id == '128') { // restrict this option for a specific calendar | |
$data['url'] = admin_url('/post.php?post=' . $id . '&action=edit'); | |
$data['url_new_window'] = 'true'; | |
} | |
} | |
return $data; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('check_if_render_live_tooltip', 'render_live_tooltip_pages', 10, 2); | |
function render_live_tooltip_pages($render_tooltip, $id) { | |
//Apply only for specific tooltip id | |
if ($id == '733') { | |
$post_ids_not_to_render = array(102, 142); | |
if (is_page($post_ids_not_to_render) || is_single($post_ids_not_to_render)) { | |
//Do not render tooltip | |
return false; | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('wp_enqueue_scripts', 'cmcal_custom_script', 9999); | |
function cmcal_custom_script(){ | |
$output = "function cmcal_custom_title(start, end, locale, view, calendar_id) { | |
if (view == 'dayGridMonth') { | |
jQuery('#cmcal_calendar_' + calendar_id + ' .fc-day-number').each(function () { | |
var day = jQuery(this).html(); | |
var day_new = day.replace('日', ''); | |
jQuery(this).html(day_new); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('cmcal_calendar_event', 'cmcal_calendar_set_color', 10, 2); | |
function cmcal_calendar_set_color($event, $calendar_id) { | |
$event_properties = $event->properties; | |
$event_id = $event_properties["id"]; | |
// replace 'event-categories' with your taxonomy slug | |
$terms = get_the_terms($event_id, 'event-categories'); | |
if (!empty($terms)) { | |
foreach ($terms as $term) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Hide category and tag at the same time, uses an OR operator. Use the code below to change it to AND. | |
add_filter('wcpv_where', 'wcpv_where_custom', 10, 2); | |
function wcpv_where_custom($subquery, $query) { | |
$subquery = preg_replace('/AND/', '', $subquery, 1); | |
$subquery = str_replace('OR', 'AND', $subquery); | |
$subquery = 'AND ' . $subquery; | |
return $subquery; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('admin_enqueue_scripts', 'hotspot_draggable_fix', 9999999999); | |
function hotspot_draggable_fix($enqueue_imagesloaded) { | |
$tooltip_styles = '.wpcmtt_hotspot_container .drag_element.ui-draggable { | |
width: unset !important; | |
}'; | |
wp_add_inline_style('wpcmtt-hotspot-backend-css', $tooltip_styles); | |
} |
NewerOlder