Skip to content

Instantly share code, notes, and snippets.

@ckpicker
ckpicker / gist:9367837
Created March 5, 2014 14:08
Events Calendar PRO 3.4 // Add CSS Class to custom fields based on content
add_action( 'wp_footer', 'options_add_javascript' );
function options_add_javascript() {
?>
<script type="text/javascript">
//Add Class to Option 1
jQuery('dd.tribe-meta-value:contains("Option 1")').addClass('option-1');
//Add Class to Option 2
jQuery('dd.tribe-meta-value:contains("Option 2")').addClass('option-2');
@ckpicker
ckpicker / gist:9368480
Last active August 29, 2015 13:57
Events Calendar 3.4.1 // Remove End Time from Single Event Meta
add_filter( 'tribe_event_meta_event_date', 'remove_end_time' );
function remove_end_time( $html ) {
$date_pieces = explode(' - ', $html);
$html = $date_pieces[0] . '</abbr></dd>';
return $html;
}
@ckpicker
ckpicker / gist:9555637
Last active August 29, 2015 13:57
Events Calendar 3.4 // Add Category Slugs to body_class() when viewing Single Events
add_filter('body_class', 'event_category_body_classes');
function event_category_body_classes($classes) {
if ( tribe_is_event() && is_single() ) {
//Query event categories
$event_categories = wp_get_post_terms( get_the_ID(), 'tribe_events_cat' );
if( !empty( $event_categories ) ) {
foreach( $event_categories as $single_category ) {
@ckpicker
ckpicker / gist:9641828
Created March 19, 2014 13:38
Events Calendar 3.4.1 // Hide "Unnamed Venue" from single event meta
add_filter( 'tribe_event_pro_meta_venue_name', 'hide_unnamed_venues_from_meta' );
function hide_unnamed_venues_from_meta( $html ) {
if ( false !== strpos( $html, 'Unnamed Venue' ) ) return '';
return $html;
}
@ckpicker
ckpicker / gist:9666551
Created March 20, 2014 15:36
Community Events Add-on 3.4 // Hide specific widget on Community Pages
add_action( 'wp_head', 'community_add_css' );
function community_add_css() {
if (tribe_is_community_edit_event_page() || tribe_is_community_my_events_page()) {
?>
<style>
#sidebar #feature-posts {display:none !important;}
</style>
<?php
}
}
@ckpicker
ckpicker / gist:9919873
Last active August 29, 2015 13:57
Events Calendar 3.5 // Kill Responsive code
//Look here for further documentation: http://tri.be/support/documentation/events-calendar-themers-guide/#responsivetemplates
add_filter( 'tribe_events_kill_responsive', '__return_true');
@ckpicker
ckpicker / gist:9933505
Created April 2, 2014 12:54
Events Calendar 3.5 // Modify widget footer text
// 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:9936083
Created April 2, 2014 15:08
Events Calendar 3.5 // Add Organizer Data to single-event.php
<?php
$additional_values = array();
$additional_values['organizer'] = tribe_get_organizer($event_id);
?>
<div id="tribe-events-event-<?php echo $event_id ?>" class="<?php tribe_events_event_classes() ?>" data-tribejson='<?php echo tribe_events_template_data( $post, $additional_values ); ?>'>
<h3 class="tribe-events-month-event-title summary"><a href="<?php tribe_event_link( $post ); ?>" class="url"><?php the_title() ?></a></h3>
</div><!-- #tribe-events-event-# -->
@ckpicker
ckpicker / gist:9963018
Last active August 29, 2015 13:58 — forked from faction23/gist:8675209
Events Calendar 3.4 // Modify height of Week View and change start time
//This function adds javascript to the <head> declaration of your site
//NOTE: This is only compatible with version 3.4
add_action( 'wp_head', 'modify_week_view');
function modify_week_view() {
?>
<script type="text/javascript">
jQuery(document).ready(function ($) {
@ckpicker
ckpicker / gist:9975332
Last active August 29, 2015 13:58
Events Calendar 3.5.1 // Change title of Upcoming Events
// Runs the <title> element through our custom filter
add_filter('wp_title', 'filter_events_title');
// Runs the Page title element through our custom filter
add_filter('tribe_get_events_title', 'filter_events_title');
// Tribe events: Manually set title for each page
function filter_events_title ($title) {
if ( tribe_is_upcoming() && !is_tax() ) { // List View Page: Upcoming Events
$title = 'List view: Upcoming events page';