Skip to content

Instantly share code, notes, and snippets.

@ckpicker
ckpicker / gist:e44578587d4e127d53ca
Last active January 22, 2021 18:16
Events Calendar 3.6 // Customize 'Event has Passed' notice
add_filter( 'tribe_events_the_notices', 'customize_notice', 10, 2 );
function customize_notice( $html, $notices ) {
//If text is found in notice, then replace it
if( stristr( $html, 'This event has passed.' ) ) {
//Customize the message as needed
$html = str_replace( 'This event has passed.', 'This event has passed and <a href="">add a link</a>.', $html );
}
return $html;
}
@ckpicker
ckpicker / gist:8aa1390da48520f88149
Last active August 29, 2015 14:02
Community Events 3.6 // Customize 'Event Submitted' text
add_filter('tribe_community_events_form_errors', 'customize_thank_you_message', 10, 2);
function customize_thank_you_message( $messages ) {
if ( is_array( $messages ) ) {
foreach ( $messages as $key => $message ) {
if( $message['type'] === 'update' ) {
$messages[$key]['message'] = 'Thanks for submitting your event! You can add other helpful information or HTML here also.';
}
}
@ckpicker
ckpicker / gist:cbc1bc4d798604d8eb77
Created June 6, 2014 14:19
Community Events 3.6 // Remove Selected Categories from Submission Form
add_filter( 'tribe_community_events_event_categories', 'remove_community_categories' );
function remove_community_categories( $cats ) {
//Category IDs to exclude
$excluded_cat_ids = array(4,12);
foreach ($cats as $key => $single_cat) {
//If item is found in array, then remove it
if( in_array( $single_cat->term_id, $excluded_cat_ids ) ) {
unset( $cats[$key] );
@ckpicker
ckpicker / gist:f1e8428416636d4baa57
Created May 27, 2014 13:11
Events Calendar 3.5 // Disable Comments Feed for Single Events
// disable comment feeds for individual events
function disableEventsCommentsFeedLink( $for_comments ) {
if( tribe_is_event() )
return;
}
add_filter('post_comments_feed_link','disableEventsCommentsFeedLink');
@ckpicker
ckpicker / gist:c313f3677a13b866035c
Created May 26, 2014 14:04
Events Calendar 3.5 // Remove 'End Time' from List View
add_filter('tribe_events_event_schedule_details_formatting', 'change_schedule_formatting');
function change_schedule_formatting( array $format ) {
$format['show_end_time'] = false; // This removes the end time
return $format;
}
@ckpicker
ckpicker / gist:2bf2f68517fb6237a4d3
Created May 26, 2014 13:44
Events Calendar 3.5 // Change 'Events' to 'Activities'
// See the codex to learn more about WP text domains:
// http://codex.wordpress.org/Translating_WordPress#Localization_Technology
// Example Tribe domains: 'tribe-events-calendar', 'tribe-events-calendar-pro'...
add_filter('gettext', 'theme_filter_text', 10, 3);
function theme_filter_text( $translations, $text, $domain ) {
// Copy and modify the following if {} statement to replace multiple blocks of text
// Match the text you want you want to translate, preferably also match the text domain
@ckpicker
ckpicker / gist:47fa86391773ddb563bd
Created May 22, 2014 13:04
Events Calendar 3.5 // Hide Organizer from Single Event Meta
function hide_event_organizer_meta(){
tribe_set_the_meta_visibility( 'tribe_event_organizer', false, 'meta_group' );
}
@ckpicker
ckpicker / gist:f803615d7eb429f1b12b
Last active August 29, 2015 14:01
Community Events 3.5 & The Events Calendar 3.5 // Change Organizer to Coordinator Globally
function filter_translations($translations, $text, $domain) {
if ($domain == 'tribe-events-community' || $domain == 'tribe-events-calendar') {
$text = str_ireplace( 'Organizer', 'Coordinator', $text );
}
return $text;
}
add_filter('gettext', 'filter_translations', 10, 3);
@ckpicker
ckpicker / gist:4d570fb29217df9ca603
Last active August 29, 2015 14:01
Events Calendar 3.5 // Example of how to use filters to modify HTML generated by a function
add_filter('tribe_events_the_previous_month_link', 'change_prev_link', 10, 3);
function change_prev_link( $html ) {
//Do some code to transform the HTML Here
//Return the transformed HTML to be displayed
return $html;
}
@ckpicker
ckpicker / gist:2a6717f5c1a0a322ef33
Created May 21, 2014 13:03
Events 3.5 // Change 'Upcoming Events' text to "What's On"
// See the codex to learn more about WP text domains:
// http://codex.wordpress.org/Translating_WordPress#Localization_Technology
// Example Tribe domains: 'tribe-events-calendar', 'tribe-events-calendar-pro'...
add_filter('gettext', 'theme_filter_text', 10, 3);
function theme_filter_text( $translations, $text, $domain ) {
// Copy and modify the following if {} statement to replace multiple blocks of text
// Match the text you want you want to translate, preferably also match the text domain