Search
Close this search box.

Filter Hooks

This documentation page is currently under construction, please reach out to us if you have questions regarding custom development

General Purpose Filters

These filters are used to override various general settings, text, and functionality throughout the plugin.

megacal_event_detail_page_default_title

Filters the default page title when an Event Detail page is auto-generated

Params:

  • String $page_title The page title – Default: ‘Event’

Examples:

// .. functions.php ..
function my_custom_page_title( $page_title ) {
    return 'My Custom Page';
}
add_filter( 'megacal_event_detail_page_default_title', 'my_custom_page_title' );

megacal_image_size_{image_size}_width

Filters the image size width, where {image_size} is one of mega-square, mega-detail, or mega-banner

Params:

  • Int $width The image size width

Examples:

// .. functions.php ..
if( defined( 'MEGACAL_IMG_SIZE_SQUARE' ) {
    function my_custom_image_width( $width ) {
        return 150;
    }
    add_filter( 'megacal_image_size_' . MEGACAL_IMG_SIZE_SQUARE . '_width', 'my_custom_image_width' );
}

megacal_image_size_{image_size}_height

Filters the image size height, where {image_size} is one of mega-square, mega-detail, or mega-banner

Params:

  • Int $height The image size height

Examples:

// .. functions.php ..
if( defined( 'MEGACAL_IMG_SIZE_SQUARE' ) {
    function my_custom_image_height( $height ) {
        return 150;
    }
    add_filter( 'megacal_image_size_' . MEGACAL_IMG_SIZE_SQUARE . '_height', 'my_custom_image_height' );
}

megacal_generate_ics_request_args

Filters the megacal_get_public_events args before the API request is sent, when generating an ics export for Google Cal, iCal, or other calendars

Params:

  • Array $args The arguments

Examples:

// .. functions.php ..
function my_custom_ics_args( $args ) {

    // Get a list of past events only
    $args['upcoming'] = false;
    return $args;

}
add_filter( 'megacal_generate_ics_request_args', 'my_custom_ics_args' );

megacal_ics_calendar_output

Filters the final ics output before it is served to the page

Params:

  • String $output The ics file output, as a string

Examples:

// .. functions.php .. 
function my_custom_function( $output ) {
    error_log( $output );
    return $output;
}
add_filter( 'megacal_ics_calendar_output', 'my_custom_function' );

megacal_event_detail_page_state

Filters the page state text (Admin screen page label)

Params:

  • String $state The page state – Default: ‘Event Detail Page’

Examples:

// .. functions.php ..
function my_custom_state( $state ) {
    return 'My Custom Event Detail Label';
}
add_filter( 'megacal_event_detail_page_state', 'my_custom_state' );

megacal_event_detail_content

Filters the Event Detail page content after it has been built, but before it’s displayed

Params:

  • String $content The page content

Examples:

// .. functions.php ..
function my_custom_function( $content ) {

    // replace all occurrences of 'foo' with 'bar' in the Event Detail content
    $content = str_replace( 'foo', 'bar', $content );

    return $content;

}
add_filter( 'megacal_event_detail_content', 'my_custom_function' );

megacal_get_wp_datetime_timezone

Filters the timezone on our internal function to convert dates to DateTime objects.
You should use this if you want event timezones to be different than your WP timezone

Params:

  • DateTimeZone $timezone The timezone – Default: wp_timezone()

Examples:

// .. functions.php ..
function my_custom_timezone( $timezone ) {
    // Force all event dates to use the 'America/New_York' timezone
    return new DateTimeZone( 'America/New_York' );
}
add_filter( 'megacal_get_wp_datetime_timezone', 'my_custom_timezone' );

megacal_admin_bar_visibility_capability

Filters the capability required to view the admin bar menu

Params:

  • String $cap The capability required to see the admin bar menu – Default: ‘publish_posts’

Examples:

// .. functions.php ..
function my_custom_admin_bar( $cap ) {
    // Change admin bar menu visibility capability
    return 'manage_options';
}
add_filter( 'megacal_admin_bar_visibility_capability', 'my_custom_admin_bar' );

megacal_validate_input

Filters sanitized/validated input from settings

Params:

  • Array $output The sanitized input
  • Array $input The raw input

Examples:

// .. functions.php ..
function my_validate_input( $output, $input ) {

    // Force the no events found message to be 'My Override'
    $output['megacal_no_event_msg'] = 'My Override';
    return $output;
}
add_filter( 'megacal_validate_input', 'my_validate_input', 10, 2 );

megacal_render_manage_page_visibility_capability

Filters the capability required to view the manage page

Params:

  • String $cap The capability required to see the manage page – Default: ‘publish_posts’

Examples:

// .. functions.php ..
function my_custom_manage_page( $cap ) {
    // Change admin bar menu visibility capability
    return 'manage_options';
}
add_filter( 'megacal_render_manage_page_visibility_capability', 'my_custom_manage_page' );

megacal_render_upgrade_page_visibility_capability

Filters the capability required to view the upgrade page

Params:

  • String $cap The capability required to see the upgrade page – Default: ‘publish_posts’

Examples:

// .. functions.php ..
function my_custom_upgrade_page( $cap ) {
    // Change admin bar menu visibility capability
    return 'manage_options';
}
add_filter( 'megacal_render_upgrade_page_visibility_capability', 'my_custom_upgrade_page' );

megacal_preprocess_save_event_data

Allows you to override or extend the preprocessing applied to the POSTed event data.
This deals with extra escaping causing issues with special characters, actual sanitization happens later

Params:

  • string $preprocessed_data The value after it’s been run through stripslashes
  • string $key The key for the field being processed
  • string $raw The raw POSTed data, before it’s been sanitized or processed

Examples:

// .. functions.php .. 
function my_preprocess_save_event_data( $preprocessed_data, $key, $raw ) {
    // Strip all HTML tags from event data
    return strip_tags( $preprocessed_data );
}
add_filter( 'megacal_preprocess_save_event_data', 'my_preprocess_save_event_data', 10, 3 );

megacal_save_event_default_category_name

Filters the default category name when saving an event – Must be an existing Event Category.
Only runs when Default category hasn’t been set in your settings.

Params:

  • string $category The category name – Default: ‘Default’

Examples:

// .. functions.php ..
function my_custom_default_category( $category ) {
    return 'Custom Default';
}
add_filter( 'megacal_save_event_default_category_name', 'my_custom_default_category' );

megacal_save_event_args

Filters the arguments before sending a create or update Event request

Params:

  • Array $args The request arguments
  • String $action The action being performed – ‘update_event’, ‘create_event’

Examples:

// .. functions.php ..
function my_custom_save_event( $args, $action ) {

    // Set all event dates to today
    $args['event_date'] = date( 'Y-m-d', now() ); 
    return $args;

}
add_filter( 'megacal_save_event_args', 'my_custom_save_event', 10, 2 );

megacal_sanitize_and_filter_array

Filters our internal function used to sanitize array values

Params:

  • Array $sanitized The sanitized array
  • Array $arr The original array

Examples:

// .. functions.php ..
functions my_custom_sanitize_array( $sanitized, $arr ) {

    // Output both arrays to the error log for review
    error_log( print_r( $arr, true ) );
    error_log( print_r( $sanitized, true ) );

    return $sanitized;

}
add_filter( 'megacal_sanitize_and_filter_array', 'my_custom_sanitize_array', 10, 2 );

megacal_fetch_list_events_results_per_page

Filters the total number of events per page for all Event List views

Params:

  • Int $results_per_page The total number of results per page – Default: 15

Examples:

// .. functions.php ..
function my_custom_results_per_page( $results_per_page) {
    // Change total results per page to 50
    return 50;
}
add_filter( 'megacal_fetch_list_events_results_per_page', 'my_custom_results_per_page' );

megacal_get_upcoming_events_args

Filters the Upcoming Events request args before the request is sent and before it’s cached

Params:

  • Array $args The request args

Exanples:

// .. functions.php ..
function my_custom_upcoming_events( $args ) {
    // Include published and unpublished events
    unset( $args['published'] );
    return $args;
}
add_filter( 'megacal_get_upcoming_events_args', 'my_custom_upcoming_events' );

megacal_get_past_events_args

Filters the Past Events request args before the request is sent and before it’s cached

Params:

  • Array $args The request args

Exanples:

// .. functions.php ..
function my_custom_past_events( $args ) {
    // Include published and unpublished events
    unset( $args['published'] );
    return $args;
}
add_filter( 'megacal_get_past_events_args', 'my_custom_past_events' );

megacal_flush_event_cache_keys

Use this hook to modify the list of cache keys that are flushed when event updates occur.

You can use this to include any custom cache keys that you implement on your own.

Params:

  • Array $cache_keys A list of cache keys associated with different event lists

Examples:

// .. functions.php ..
function my_custom_event_cache_keys( $cache_keys ) {
    // Include a custom cache key when event cache is flushed
    $cache_keys[] = 'my-custom-event-cache-key';
    return $cache_keys;
}
add_filter( 'megacal_flush_event_cache_keys', 'my_custom_event_cache_keys' );

megacal_flush_upsert_cache_keys

Use this hook to modify the list of cache keys that are flushed when the upsert cache flush occurs

You can use this to include any custom cache keys that you implement on your own.

Params:

  • Array $cache_keys A list of cache keys associated with different event lists

Examples:

// .. functions.php ..
function my_custom_upsert_cache_keys( $cache_keys ) {
    // Include a custom cache key when upsert cache is flushed
    $cache_keys[] = 'my-custom-upsert-cache-key';
    return $cache_keys;
}
add_filter( 'megacal_flush_upsert_cache_keys', 'my_custom_upsert_cache_keys' );

megacal_strip_unicode_char_map

Filters our internal map of unicode characters that are stripped from input – Use this if you have special characters that you want to strip from input.

NOTE: You can’t remove our defaults

Params:

  • Array $char_map The unicode characters to be stripped

Examples:

// .. functions.php ..
function my_custom_char_map( $char_map ) {

    // Strip » and « from event input
    $char_map = '»';
    $char_map = '«';
    return $char_map;

}
add_filter( 'megacal_strip_unicode_char_map', 'my_custom_char_map' );

megacal_esc_wysiwyg

Filters the output from megacal_esc_wysiwyg before it is rendered. We apply wp_kses_post and wpautop to wysiwyg output.
This filter allows you to change how the content is escaped and transformed,  before it’s rendered.

Params:

  • String $content The content after we have transformed it
  • String $raw The raw, unescaped content as the function received it

Examples:

// .. functions.php .. 
function my_custom_esc_wysiwyg( $content, $raw ) {
    // Bypass wpautop on content
    return wp_kses_post( $raw );
}
add_filter( 'megacal_esc_wysiwyg', 'my_custom_esc_wysiwyg', 10, 2 );

megacal_get_events_result

Filters the resulting value from megacal_get_events

Params:

  • Array<Event>|String $events The array of events, or the raw JSON response

Examples:

// .. functions.php ..
function my_custom_function( $events ) {
    // Check if the result is a list of Events
    error_log( is_array( $events ) );
    return $events;
}
add_filter( 'megacal_get_events_result', 'my_custom_function' );

megacal_get_template_part

Filters calls to megacal_get_template_part, before the template parts are rendered

Params:

  • Array $templates The filenames of the templates to be loaded
  • String $slug The first argument passed to megacal_get_template_part
  • String $name The second argument passed to megacal_get_template_part

Examples:

// .. functions.php ..
function my_custom_function() {

    // Replace Event Detail partial with a custom template
    foreach( $templates as &$template ) {
        if( $template == 'views/megacal-event-detail.php' ) {
            $template = 'views/my-custom-detail.php';
        }
    }

    return $templates;

}
add_filter( 'megacal_get_template_part', 'my_custom_function', 10, 3 );

megacal_locate_template_theme_dir

Filters the template override theme directory name

Params:

  • String $dir The theme override directory – Default: ‘megabase-calendar/’

Examples:

// .. functions.php .. 
function my_custom_function( $dir ) { 
    // Change theme template override directory
    return 'my-custom-dir/';
} 
add_filter( 'megacal_locate_template_theme_dir', 'my_custom_function' );

megacal_default_event_image_path

Filters the default event image url

Params:

  • String $path The url to the default image – Default: https://domain.com/wp-content/plugins/megabase-calendar/assets/img/default-event.jpg

Examples:

// .. functions.php .. 
function my_custom_function( $path ) { 
    // Change default event image
    return get_stylesheet_uri() . '/images/my-custom-img.jpg';
} 
add_filter( 'megacal_default_event_image_path', 'my_custom_function' );

megacal_update_nag

Allows you to turn off the update nag on the Manage Events screen

Params:

  • Bool $update_nag True/False – Default: True

Examples:

// .. functions.php .. 
add_filter( 'megacal_update_nag', '__return_false' ); // Disable MegaCalendar Update nag

megacal_month_label_fmt

Filters the month label formatting on the Event lists – Must be a valid PHP date format

Params:

  • String $fmt The format – Default: ‘F’
  • DateTime $date The date being formatted
  • String $previous_month The month processed on the previous event

Examples:

// .. functions.php ..
function my_custom_function( $fmt, $date, $previous_month ) { 
    // Display short month names in the Event Lists
    return 'M';
}
add_filter( 'megacal_month_label_fmt', 'my_custom_function', 10, 3 );

 

Compact Events List Filters

These filters are used to override certain settings, text, and functionality on the Compact Events List view.

megacal_compact_events_list_events

Filters the events on the compact event list view

Params:

  • Array<Event> $events The list of events to be displayed

Examples:

// .. functions.php ..
function my_custom_events( $events ) {
    // Exclude a specific event from the list by ID
    $events = array_filter( $events, function( $event ) { return $event->get_id() != 25; } );
    return $events;
}
add_filter( 'megacal_compact_events_list_events', 'my_custom_events' );

megacal_compact_events_list_hidden_categories

Allows you to modify the categories that are hidden on the Compact Event list

Params:

  • Array<String> $categories The hidden categories – Default: array( ‘Default’ )

Examples:

// .. functions.php ..
function my_hidden_categories( $categories ) {

    // Hide 'My Custom Category' in addition to 'Default'
    $categories[] = 'My Custom Category';
    return $categories;

}
add_filter( 'megacal_compact_events_list_hidden_categories', 'my_hidden_categories' );

// .. functions.php ..
function my_hidden_categories( $categories ) {
    // Hide 'My Custom Category' instead of 'Default'
    return array( 'My Custom Category' );
}
add_filter( 'megacal_compact_events_list_hidden_categories', 'my_hidden_categories' );

 

Event Detail Filters

These filters are used to override certain settings, text, and functionality on the Event Detail view.

megacal_event_detail_wrapper_classes

Filters the classes on the Event Detail wrapper

Params:

  • String $classes The classes for the Event Detail wrapper – Default: ‘megacal-event megaEventDetail’

Examples:

// .. functions.php .. 
function my_event_detail_classes( $classes ) { 
    // Replace our default class names with your own
    return 'my-custom-class';    
} 
add_filter( 'megacal_event_detail_wrapper_classes', 'my_event_detail_classes' );

// .. functions.php .. 
function my_event_detail_classes( $classes ) { 
    // Append a custom class to the Event Detail page
    return $classes . ' my-custom-class'; 
} 
add_filter( 'megacal_event_detail_wrapper_classes', 'my_event_detail_classes' );

megacal_event_detail_event_image

Filters the Event Detail images URL

Params:

  • String $image_url The image url

Examples:

// .. functions.php ..
function my_custom_image_url( $image_url ) {
    error_log( $image_url );
    return $image_url;
}
add_filter( 'megacal_event_detail_event_image', 'my_custom_image_url' );

megacal_event_detail_heading

Filters the heading text on the Event Detail page

Params:

  • String $heading The heading text

Examples:

// .. functions.php ..
function my_custom_event_title( $heading ) {
    error_log( $heading );
    return $heading;
}
add_filter( 'megacal_event_detail_heading', 'my_custom_event_title' );

megacal_event_detail_event_date_fmt

Filters the event date format on Event Detail – Must be a valid PHP date format

Params:

  • String $fmt The date format – Default: ‘l, F jS, Y’

Examples:

// .. functions.php ..
function my_custom_event_date_fmt( $fmt ) {
    // Replace date format with m/d/Y
    return 'm/d/Y';
}
add_filter( 'megacal_event_detail_event_date_fmt', 'my_custom_event_date_fmt' );

megacal_event_detail_show_venue

Allows you to hide the Venue from Event Detail, even when a Venue exists

Params:

  • Bool $show_venue True/False – Default: True

Examples:

// .. functions.php ..
add_filter( 'megacal_event_detail_show_venue', '__return_false' ); // Hide Venue on Event Detail

megacal_event_detail_venue_heading

Filters the heading that appears before the Venue name on Event Detail

Params:

  • String $heading The heading – Default: ‘Location’

Examples:

// .. functions.php ..
function my_custom_venue_label( $heading ) {
    return 'Venue';
}
add_filter( 'megacal_event_detail_venue_heading', 'my_custom_venue_label' );

megacal_event_detail_cost_label

Filters the heading that appears before the Price section on Event Detail

Params:

  • String $heading The heading – Default: ‘Price’

Examples:

// .. functions.php ..
function my_custom_cost_label( $heading )
    return 'Cost';
}
add_filter( 'megacal_event_detail_cost_label', 'my_custom_cost_label' );

megacal_event_detail_event_time_fmt

Filters the time format on the Event Detail page, allowing for custom time formatting if needed

Params:

  • String $fmt The time format – Default ‘g:ia’ OR ‘H:i’, depending on your settings

Examples:

// .. functions.php ..
function my_custom_time_fmt( $fmt ) {
    // Format time for 12-hour with leading 0's (01:25pm)
    return 'h:ia';
}
add_filter( 'megacal_event_detail_event_time_fmt', 'my_custom_time_fmt' );

megacal_event_detail_hidden_categories

Allows you to modify the categories that are hidden on the Event Detail page

Params:

  • Array<String> $categories The hidden categories – Default: array( ‘Default’ )

Examples:

// .. functions.php ..
function my_hidden_categories( $categories ) {

    // Hide 'My Custom Category' in addition to 'Default'
    $categories[] = 'My Custom Category';
    return $categories;

}
add_filter( 'megacal_event_detail_hidden_categories', 'my_hidden_categories' );

// .. functions.php ..
function my_hidden_categories( $categories ) {
    // Hide 'My Custom Category' instead of 'Default'
    return array( 'My Custom Category' );
}
add_filter( 'megacal_event_detail_hidden_categories', 'my_hidden_categories' );

megacal_event_detail_control_bar_classes

Filters the classes applied to the control bar on Event Detail

Params:

  • String $classes The additional classes to apply to the control bar – Default: ‘moveCenter’

Examples:

// .. functions.php ..
function my_custom_control_bar_class( $classes ) {
    return $classes . ' my-custom-class';
}
add_filter( 'megacal_event_detail_control_bar_classes', 'my_custom_control_bar_class' );

megacal_event_detail_description_do_shortcode

Allows you to apply do_shortcode to the event description output

NOTE: Enable at your own risk, all shortcodes in the description will be parsed and rendered

Params:

  • Bool $do_shortcode True/False: Apply do_shortcode to the event description – Default: False

Examples:

// .. functions.php ..
add_filter( 'megacal_event_detail_description_do_shortcode', '__return_true' ); // Pass Event Description content through do_shortcode before rendering

megacal_event_detail_description_do_the_content

Allows you to apply the_content to the event description output

NOTE: Enable at your own risk, all shortcodes in the description will be parsed and rendered. Takes precedence over megacal_event_detail_description_do_shortcode

Params:

  • Bool $do_the_content True/False: Apply the_content to the event description – Default: False

Examples:

// .. functions.php ..
add_filter( 'megacal_event_detail_description_do_the_content', '__return_true' ); // Pass Event Description content through the_content before rendering

megacal_event_detail_organizers_do_shortcode

Allows you to apply do_shortcode to the event organizers output

NOTE: Enable at your own risk, all shortcodes in the organizers will be parsed and rendered

Params:

  • Bool $do_shortcode True/False: Apply do_shortcode to the event organizers – Default: False

Examples:

// .. functions.php ..
add_filter( 'megacal_event_detail_organizers_do_shortcode', '__return_true' ); // Pass Event Organizers content through do_shortcode before rendering

megacal_event_detail_organizers_do_the_content

Allows you to apply the_content to the event organizers output

NOTE: Enable at your own risk, all shortcodes in the organizers will be parsed and rendered. Takes precedence over megacal_event_detail_organizers_do_shortcode

Params:

  • Bool $do_the_content True/False: Apply the_content to the event organizers – Default: False

Examples:

// .. functions.php ..
add_filter( 'megacal_event_detail_organizers_do_the_content', '__return_true' ); // Pass Event Organizers content through the_content before rendering

 

Full Events List Filters

These filters are used to override certain settings, text, and functionality on the Full Events List view.

megacal_full_events_list_events

Filters the events on the full event list view

Params:

  • Array<Event> $events The list of events to be displayed

Examples:

// .. functions.php ..
function my_custom_events( $events ) {
    // Exclude a specific event from the list by ID
    $events = array_filter( $events, function( $event ) { return $event->get_id() != 25; } );
    return $events;
}
add_filter( 'megacal_full_events_list_events', 'my_custom_events' );

megacal_full_events_list_cost_label

Filters the heading that appears before the Price section on the Full Events List

Params:

  • String $heading The heading – Default: ‘Cost: ‘

Examples:

// .. functions.php ..
function my_custom_cost_label( $heading )
    return 'Cost - ';
}
add_filter( 'megacal_full_events_list_cost_label', 'my_custom_cost_label' );

megacal_full_events_list_detail_separator

Filters the details separator on the full Events list

Params:

  • String $separator The separator – Default: ‘&bull;’

Examples:

// .. functions.php ..
function my_custom_separator( $sep )
    // Replace bullet with pipe between details
    return '|';
}
add_filter( 'megacal_full_events_list_detail_separator', 'my_custom_separator' );

megacal_full_events_list_hidden_categories

Allows you to modify the categories that are hidden on the Full Events List

Params:

  • Array<String> $categories The hidden categories – Default: array( ‘Default’ )

Examples:

// .. functions.php ..
function my_hidden_categories( $categories ) {

    // Hide 'My Custom Category' in addition to 'Default'
    $categories[] = 'My Custom Category';
    return $categories;

}
add_filter( 'megacal_full_events_list_hidden_categories', 'my_hidden_categories' );

// .. functions.php ..
function my_hidden_categories( $categories ) {
    // Hide 'My Custom Category' instead of 'Default'
    return array( 'My Custom Category' );
}
add_filter( 'megacal_full_events_list_hidden_categories', 'my_hidden_categories' );

megacal_full_events_list_description_do_shortcode

Allows you to apply do_shortcode to the event description output

NOTE: Enable at your own risk, all shortcodes in the description will be parsed and rendered

Params:

  • Bool $do_shortcode True/False: Apply do_shortcode to the event description – Default: False

Examples:

// .. functions.php ..
add_filter( 'megacal_full_events_list_description_do_shortcode', '__return_true' ); // Pass Event Description content through do_shortcode before rendering

megacal_full_events_list_description_do_the_content

Allows you to apply the_content to the event description output

NOTE: Enable at your own risk, all shortcodes in the description will be parsed and rendered. Takes precedence over megacal_event_detail_description_do_shortcode

Params:

  • Bool $do_the_content True/False: Apply the_content to the event description – Default: False

Examples:

// .. functions.php ..
add_filter( 'megacal_full_events_list_description_do_the_content
', '__return_true' ); // Pass Event Description content through the_content before rendering

megacal_full_events_list_organizers_do_shortcode

Allows you to apply do_shortcode to the event organizers output

NOTE: Enable at your own risk, all shortcodes in the organizers will be parsed and rendered

Params:

  • Bool $do_shortcode True/False: Apply do_shortcode to the event organizers – Default: False

Examples:

// .. functions.php ..
add_filter( 'megacal_full_events_list_organizers_do_shortcode', '__return_true' ); // Pass Event Organizers content through do_shortcode before rendering

megacal_full_events_list_organizers_do_the_content

Allows you to apply the_content to the event organizers output

NOTE: Enable at your own risk, all shortcodes in the organizers will be parsed and rendered. Takes precedence over megacal_event_detail_organizers_do_shortcode

Params:

  • Bool $do_the_content True/False: Apply the_content to the event organizers – Default: False

Examples:

// .. functions.php ..
add_filter( 'megacal_full_events_list_organizers_do_the_content', '__return_true' ); // Pass Event Organizers content through the_content before rendering

 

Simple Events List Filters

These filters are used to override certain settings, text, and functionality on the Simple Events List view.

megacal_simple_events_list_events

Filters the events on simple event list view

Params:

  • Array<Event> $events The list of events to be displayed

Examples:

// .. functions.php ..
function my_custom_events( $events ) {
    // Exclude a specific event from the list by ID
    $events = array_filter( $events, function( $event ) { return $event->get_id() != 25; } );
    return $events;
}
add_filter( 'megacal_simple_events_list_events', 'my_custom_events' );

megacal_simple_events_list_heading

Filters the heading text on the simple event list

Params:

  • String $heading The heading text

Examples:

// .. functions.php ..
function my_custom_event_title( $heading ) {
    error_log( $heading );
    return $heading;
}
add_filter( 'megacal_simple_events_list_heading', 'my_custom_event_title' );

megacal_simple_events_list_time_fmt

Filters the time format on the simple event list, allowing for custom time formatting if needed

Params:

  • String $fmt The time format – Default ‘g:ia’ OR ‘H:i’, depending on your settings

Examples:

// .. functions.php ..
function my_custom_time_fmt( $fmt ) {
    // Format time for 12-hour with leading 0's (01:25pm)
    return 'h:ia';
}
add_filter( 'megacal_simple_events_list_time_fmt', 'my_custom_time_fmt' );

megacal_simple_events_list_hidden_categories

Allows you to modify the categories that are hidden on the simple event list

Params:

  • Array<String> $categories The hidden categories – Default: array( ‘Default’ )

Examples:

// .. functions.php ..
function my_hidden_categories( $categories ) {

    // Hide 'My Custom Category' in addition to 'Default'
    $categories[] = 'My Custom Category';
    return $categories;

}
add_filter( 'megacal_simple_events_list_hidden_categories', 'my_hidden_categories' );

// .. functions.php ..
function my_hidden_categories( $categories ) {
    // Hide 'My Custom Category' instead of 'Default'
    return array( 'My Custom Category' );
}
add_filter( 'megacal_simple_events_list_hidden_categories', 'my_hidden_categories' );

Calendar Filters

These filters are used to control and modify Calendar view output.

megacal_excerpt_length

Allows you to change the maximum word length for the hover card excerpt.

Params:

  • Int $length The excerpt max word length – Default: 25

Examples:

// .. functions.php ..
function my_hover_card_excerpt_length( $length ) {
    // Change hover card excerpt length to 15
    return 15;
}
add_filter( 'megacal_excerpt_length', 'my_hover_card_excerpt_length' );

megacal_excerpt_more

Allows you to change the more text for the hover card excerpt.

Params:

  • String $more The excerpt more text – Default: “&hellip;”

Examples:

// .. functions.php ..
function my_hover_card_excerpt_more( $more ) {
    // Remove the hover card excerpt more text
    return '';
}
add_filter( 'megacal_excerpt_more', 'my_hover_card_excerpt_more' );

megacal_trim_content

Allows you to modify the excerpt functionality for the hover card excerpt.

Content is run through strip_shortcodes, strip_tags, then wp_trim_words in that order. This filter hook allows you to intercept the content and change that functionality. The returned value becomes the excerpt.

Params:

  • String $trimmed The trimmed content
  • String $raw The original content, before it is trimmed

Examples:

// .. functions.php ..
function my_hover_card_excerpt( $trimmed, $raw ) {
    // Render full content with shortcodes, instead of trimming
    return do_shortcode( $raw );
}
add_filter( 'megacal_trim_content', 'my_hover_card_excerpt', 10, 2 );