Skip to content

Instantly share code, notes, and snippets.

@jesseeproductions
jesseeproductions / ecp-random-events
Last active August 29, 2015 14:06
Randomize Future Events on Main Loop of Site for The Events Calendar
/*
* Randomize Future Events on Main Loop of Site for The Events Calendar
* Setting needs to be checked to show Events on Main Loop in the Events Calendar Settings
* @3.7
*/
add_action( 'pre_get_posts', 'random_posts' );
function random_posts( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
@jesseeproductions
jesseeproductions / ecp-google-cal-remove-tags
Created September 24, 2014 15:04
Remove Tags from Description for Google Calendar Export in Events Calendar
add_filter( 'tribe_google_calendar_parameters', 'remove_tags_from_gcal_links' );
function remove_tags_from_gcal_links( array $params ) {
$params['details'] = urlencode( strip_tags( urldecode( $params['details'] ) ) );
return $params;
}
@jesseeproductions
jesseeproductions / ecp-ical-filter
Last active August 29, 2015 14:06
Filter iCAL Description for Events Calendar 3.7
/*
* Filter ical Description for Events Calendar 3.7
* Removes tags and most shortcodes for single event only
*
*/
add_filter('tribe_ical_feed_item','filter_ical_description', 10, 2);
function filter_ical_description($item, $eventPost) {
$description = preg_replace( "/[\n\t\r]/", ' ', strip_tags( strip_shortcodes( $eventPost->post_content ) ) );
$description = preg_replace ("/\[(\S+)\]/e", "", $description);
@jesseeproductions
jesseeproductions / ecp-event-terms
Created September 26, 2014 22:39
Get Terms of Current Event and Display in a List without links
//Get Terms of Current Event and Display in a List without links
$terms = wp_get_post_terms(get_the_id(), 'tribe_events_cat', array("fields" => "all"));
if ( !empty( $terms ) && !is_wp_error( $terms ) ){
echo "<ul>";
foreach ( $terms as $term ) {
echo "<li>" . $term->name . "</li>";
}
echo "</ul>";
}
@jesseeproductions
jesseeproductions / ecp-rss-filter
Created September 30, 2014 11:59
The Events Calendar Filter for RSS Feed to Correct Pubdate
/*
* The Events Calendar Filter for RSS Feed to Correct Pubdate
* Modifys the first $zone check as UTC time 0 was registering as === false
*/
add_filter( 'get_post_time', 'events_rss2_gmt_pubdate_correction', 20 , 3 );
function events_rss2_gmt_pubdate_correction($time, $d, $gmt) {
global $post;
@jesseeproductions
jesseeproductions / ecp-c-remove-log-text
Created October 2, 2014 19:32
Remove Please log in first. From Events Calendar Community Add On Login @3.8
/*
* Remove Please log in first. From Events Calendar Community Add On Login
* @version 3.8
*
*/
function filter_translations($translations, $text, $domain) {
if ($domain == 'tribe-events-community') {
$text = str_ireplace( 'Please log in first.', '', $text );
@jesseeproductions
jesseeproductions / ecp-title-from-filter
Last active August 29, 2015 14:07
The Events Calendar 3.8 Filter the Page Title when a date is selected the event bar
/*
* The Events Calendar 3.8 Filter the Page Title when a date is selected the event bar
* @$title
*
*/
function filter_upcoming_events_title($title) {
if (tribe_is_list_view() || tribe_is_month()) {
if (strpos($title,'Events for') !== false && !tribe_is_past()) {
$title = "Upcoming Events";
@jesseeproductions
jesseeproductions / ecp-exclude-cat-month
Created October 16, 2014 14:37
Exclude Categories from Month View of the Events Calendar
/**
* Exclude Categories from Month View of the Events Calendar
* Change 'Concert','Convention' to your Event Category Names to work
*/
add_action( 'pre_get_posts', 'exclude_events_category' );
function exclude_events_category( $query ) {
if ( tribe_is_month() && !is_tax() ) {
@jesseeproductions
jesseeproductions / ecp-bar-filter-text
Created October 16, 2014 14:59
Change text Near on the Events Calendar Search Bar
/**
* Change text Near on the Events Calendar Search Bar
*
*/
add_filter('tribe-events-bar-filters', 'ecp_theme_filter_text', 10, 3);
function ecp_theme_filter_text( $tribebar ) {
$tribebar['tribe-bar-geoloc']['caption'] = "Custom";
return $tribebar;
@jesseeproductions
jesseeproductions / ecp-filter-title
Created October 20, 2014 23:52
Filter Single Event Title in the Events Calendar 3.8
/**
* Filter Single Event Title in the Events Calendar 3.8 to Remove Upcoming Events
*
*/
add_filter('tribe_events_title_tag', 'ecp_filter_single_title', 10, 4);
function ecp_filter_single_title( $title_filter, $new_title, $title, $sep ) {
if( tribe_is_event() && is_single() ) {
$title_filter = str_replace('Upcoming Events |', '', $title_filter);