Skip to content

Instantly share code, notes, and snippets.

@ckpicker
ckpicker / vanilla.js
Created June 5, 2018 13:51
Using vanilla js instead of jquery
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 January 5, 2015 16:08
Events Calendar // Filters to Override Event Label
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 November 17, 2014 17:25
The Events Calendar // Dequeue Styles
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 October 22, 2014 03:01
The Events Calendar // Add Breadcrumbs support to TEC
// 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 October 22, 2014 02:40
Community Events Add-on // Add Custom CSS to Community Events 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>
YOUR CSS STYLES GO HERE
</style>
<?php
}
}
@ckpicker
ckpicker / gist:a754cbffa3c37b4a8c30
Created October 21, 2014 02:58
The Events Calendar // Add thumbnails to Upcoming Events list widget
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 August 20, 2014 17:56
Events Calendar 3.7 // Hook into 'tribe_events_inside_before_loop' action to display custom text for list view
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 August 5, 2014 19:40
Events Calendar 3.7 // Query Events by City & Country
<?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 July 17, 2014 18:33
Events Calendar 3.6 // Remove End Time in the Schedule Details
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 July 17, 2014 15:43
Community Events 3.6 // Remove Specified Categories from Submission Screen for non-admins
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 ) {