Skip to content

Instantly share code, notes, and snippets.

@ckpicker
ckpicker / gist:8689212
Created January 29, 2014 14:33
The Events Calendar 3.4.1 // Disable AJAX paging on Calendar month view
add_action( 'wp_enqueue_scripts', 'sd_frontend_script_and_style', 100, 0 );
function sd_frontend_script_and_style() {
if(tribe_is_month()) {
wp_dequeue_script( 'tribe-events-calendar' );
}
}
@ckpicker
ckpicker / gist:8732183
Created January 31, 2014 13:35
Community Events Add-on 3.4 // Hide Country & State Dropdown
add_action( 'wp_footer', 'community_add_javascript' );
function community_add_javascript() {
if (tribe_is_community_edit_event_page()) {
?>
<script type="text/javascript">
//Hide country dropdown
jQuery('tr.venue:eq(2)').hide();
//Hide state dropdown
@ckpicker
ckpicker / gist:8740668
Created January 31, 2014 18:58
Community Events Add-on 3.4 // Hide Image Upload Section for Event Submissions
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>
#event_image_uploader {display:none !important;}
</style>
<?php
}
}
@ckpicker
ckpicker / gist:9008700
Last active August 29, 2015 13:56
Community Add-on 3.4.1 // Restrict Event Submission for Certain Roles
add_action( 'wp_head', 'community_restrict_access' );
function community_restrict_access() {
if (tribe_is_community_edit_event_page() || tribe_is_community_my_events_page()) {
if(current_user_can('subscriber') || current_user_can('custom_role_name')) {
wp_redirect( get_bloginfo('home') . "/error/" ); exit;
}
}
}
@ckpicker
ckpicker / gist:9051733
Created February 17, 2014 14:35
Community Events Add-on 3.4 // Disable Organizer and Venue Dropdowns
add_action( 'wp_footer', 'community_add_javascript' );
function community_add_javascript() {
if (tribe_is_community_edit_event_page()) {
?>
<script type="text/javascript">
//Hide organizer dropdown
jQuery('#event_organizer tr:eq(1)').hide();
//Hide venue dropdown
@ckpicker
ckpicker / gist:9051867
Created February 17, 2014 14:44
Events PRO 3.4.1 // Load all assets over SSL if on an encrypted connection
add_filter( 'init', 'enforce_ssl_ecp', 5 );
function enforce_ssl_ecp() {
if ( ! is_ssl() || ! class_exists( 'TribeEventsPro' ) ) return;
$pro = TribeEventsPRO::instance();
$pro->pluginUrl = str_replace( 'http://', 'https://', $pro->pluginUrl );
}
@ckpicker
ckpicker / gist:9209189
Created February 25, 2014 13:55
Community Events Add-on 3.4.1 // Add Text Above Category Box
add_filter('tribe_events_community_before_the_categories','my_category_descriptions');
function my_category_descriptions() {
echo "<p><strong>Category Descriptions:</strong></p><ul><li>Category 1 - Description Here</li><li>Category 2 - Description Here</li></ul>";
}
@ckpicker
ckpicker / gist:9327495
Last active August 29, 2015 13:56
Events Calendar 3.4.1 // Remove HTML Before only on Single Event Pages
add_action('tribe_events_before_html','customize_html');
function customize_html($code) {
//If viewing a single event page, then don't display anything
if(tribe_is_event() && is_single()) {
return '';
} else {
return $code;
}
}
@ckpicker
ckpicker / gist:9346705
Last active August 29, 2015 13:56
Events Calendar 3.4.1 // Output all Event Category Descriptions for a given event
//Get all categories for a given events
$event_cats = get_terms('tribe_events_cat');
if(!empty($event_cats)) {
//Loop through Event Categories and display description
foreach($event_cats as $event_cat) {
echo term_description( $event_cat->term_id, 'tribe_events_cat' );
}
}
@ckpicker
ckpicker / gist:9348720
Created March 4, 2014 15:37
Community Events 3.4 // Display Category Descriptions on Submission Form
add_filter('tribe_events_community_before_the_categories','my_category_descriptions');
function my_category_descriptions() {
echo '<div class="tribe-events-community-details eventForm bubble tribe-events-community-category-descriptions">';
//Get all categories
$event_cats = get_terms('tribe_events_cat');
if(!empty($event_cats)) {
remove_filter('term_description','wpautop');
//Loop through Event Categories and display description
echo '<ul>';