Skip to content

Instantly share code, notes, and snippets.

Avatar

Casey Picker ckpicker

View GitHub Profile
@ckpicker
ckpicker / vanilla.js
Created Jun 5, 2018
Using vanilla js instead of jquery
View vanilla.js
import delegate from 'delegate';
const el = {
siteHeader: document.querySelector('.site-header'),
};
/**
* @function toggleMenu
* @description Toggle the menu open and closed
*/
@ckpicker
ckpicker / gist:ba9b617afdbdb3867159
Created Jan 5, 2015
Events Calendar // Filters to Override Event Label
View gist:ba9b617afdbdb3867159
add_filter( 'tribe_event_label_singular', 'event_display_name' );
function event_display_name() {
return 'XXXX';
}
add_filter( 'tribe_event_label_plural', 'event_display_name_plural' );
function event_display_name_plural() {
return 'XXXXs';
}
@ckpicker
ckpicker / gist:ffe7c737b73e5d581bad
Created Nov 17, 2014
The Events Calendar // Dequeue Styles
View gist:ffe7c737b73e5d581bad
function dequeue_tribe_styles() {
// Dequeue events calendar stylesheets
wp_dequeue_style( 'tribe-events-full-calendar-style' );
wp_dequeue_style( 'tribe-events-calendar-style' );
wp_dequeue_style( 'tribe-events-calendar-full-mobile-style' );
wp_dequeue_style( 'tribe-events-calendar-mobile-style' );
wp_dequeue_style( 'tribe-events-full-pro-calendar-style' );
wp_dequeue_style( 'tribe-events-calendar-pro-style' );
wp_dequeue_style( 'tribe-events-calendar-full-pro-mobile-style' );
@ckpicker
ckpicker / gist:6875eb645a28df2a6db2
Created Oct 22, 2014
The Events Calendar // Add Breadcrumbs support to TEC
View gist:6875eb645a28df2a6db2
// Check if page is direct child
function is_child( $page_id ) {
global $post;
if( is_page() && ($post->post_parent != '') ) {
return true;
} else {
return false;
}
}
@ckpicker
ckpicker / gist:b5cd24e28819181b5f7b
Created Oct 22, 2014
Community Events Add-on // Add Custom CSS to Community Events Pages
View gist:b5cd24e28819181b5f7b
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>
YOUR CSS STYLES GO HERE
</style>
<?php
}
}
@ckpicker
ckpicker / gist:a754cbffa3c37b4a8c30
Created Oct 21, 2014
The Events Calendar // Add thumbnails to Upcoming Events list widget
View gist:a754cbffa3c37b4a8c30
function custom_widget_featured_image() {
global $post;
echo tribe_event_featured_image( $post->ID, 'thumbnail' );
}
add_action( 'tribe_events_list_widget_before_the_event_title', 'custom_widget_featured_image' );
@ckpicker
ckpicker / gist:7bc941f32f1abdb1c241
Created Aug 20, 2014
Events Calendar 3.7 // Hook into 'tribe_events_inside_before_loop' action to display custom text for list view
View gist:7bc941f32f1abdb1c241
add_action( 'tribe_events_inside_before_loop', 'output_custom_code' );
function output_custom_code() {
//Check if displaying list view
if( tribe_is_upcoming() ) {
echo 'Your custom code to display.';
}
}
@ckpicker
ckpicker / gist:b247169a4f124fa6ea7c
Created Aug 5, 2014
Events Calendar 3.7 // Query Events by City & Country
View gist:b247169a4f124fa6ea7c
<?php
//Retrieve venues that match query criteria
$args = array(
'nopaging' => true,
'post_type'=>'tribe_venue',
//Only query venues in specific locations
'meta_query' => array(
'relation' => 'AND',
//Specific City
array(
@ckpicker
ckpicker / gist:75fecbc6209538b1daf2
Created Jul 17, 2014
Events Calendar 3.6 // Remove End Time in the Schedule Details
View gist:75fecbc6209538b1daf2
add_filter( 'tribe_events_event_schedule_details_formatting', 'remove_end_time', 10, 2);
function remove_end_time( $formatting_details ) {
$formatting_details['show_end_time'] = 0;
return $formatting_details;
}
@ckpicker
ckpicker / gist:472fbe0c96e209d2bf0d
Created Jul 17, 2014
Community Events 3.6 // Remove Specified Categories from Submission Screen for non-admins
View gist:472fbe0c96e209d2bf0d
add_filter( 'tribe_community_events_event_categories', 'hide_category_for_non_admins', 10, 2);
function hide_category_for_non_admins( $categories ) {
//Array of Category slugs to hide for non-admins
$categories_to_hide = array( 'concert', 'convention' );
//If user is not admin
if( !current_user_can( 'manage_options' ) ) {
foreach( $categories as $key => $single_cat ) {