Skip to content

Instantly share code, notes, and snippets.

@jentheo
jentheo / gist:74a2b3590131167ec7b529410cce1977
Created May 18, 2017 23:12
Remove iCal feed link from <head>
function tribe_remove_ical_feed_link() {
if ( function_exists( 'tribe' ) ) {
remove_action( 'wp_head', array( tribe( 'tec.iCal' ), 'set_feed_link' ), 2 );
}
}
add_action( 'init', 'tribe_remove_ical_feed_link', 20 );
@jentheo
jentheo / remove-checkedin-attendees.php
Last active May 24, 2017 15:36
Remove checked in tickets from Attendees list (RSVP & WooCommerce)
<?php
function attendee_screen_filter_out_checked_in_attendees( $query ) {
$attendee_post_types = array(
'tribe_rsvp_attendees',
'tribe_wooticket'
);
if ( ! in_array( $query->get( 'post_type' ), $attendee_post_types ) ) {
return;
}
@jentheo
jentheo / single-event.php
Last active June 29, 2017 04:05
Require users to be logged in to view event details
<?php
/**
* Single Event Template
* A single event. This displays the event title, description, meta, and
* optionally, the Google map for the event.
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/single-event.php
*
* @package TribeEventsCalendar
* @version 4.3
@jentheo
jentheo / custom-content.php
Last active July 7, 2017 21:09
Custom content blocks for events pages
<?php
// Text über/unter Ausstellungskalender (The Event Calendar)
function tribe_custom_content_before() {
if( ! tribe_is_community_edit_event_page() && ! tribe_is_community_my_events_page() ) {
//Before content (Month view) A
if( tribe_is_month() ) {
@jentheo
jentheo / taxonomy.php
Created August 9, 2017 03:27
Set default taxonomy for Community Events form
<?php
// Don't load directly
defined( 'WPINC' ) or die;
/**
* Event Submission Form Taxonomy Block
* Renders the taxonomy field in the submission form.
*
* Override this template in your own theme by creating a file at
* [your-theme]/tribe-events/community/modules/taxonomy.php
@jentheo
jentheo / loop.php
Created August 16, 2017 22:52
Exclude recurring events from list view after first event has started
<?php
/**
* List View Loop
* This file sets up the structure for the list loop
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/list/loop.php
*
* @version 4.4
* @package TribeEventsCalendar
*
@jentheo
jentheo / limit_ticket_quantity.php
Created August 28, 2017 22:23
Limit the number of tickets user can select on event page
/* Tribe, limit ticket qty */
function tribe_limit_tickets() {
?>
<script type="text/javascript">
jQuery(document).ready( function( $ ) {
// do this if tickets available
if ( $('.available-stock').length ) {
// set max qty to 2
$('.tribe-events-tickets .qty').attr('max', 2);
@jentheo
jentheo / single-event.php
Created September 21, 2017 19:55
Add a custom message when ticket aren't on sale
<?php
/**
* Single Event Template
* A single event. This displays the event title, description, meta, and
* optionally, the Google map for the event.
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/single-event.php
*
* @package TribeEventsCalendar
* @version 4.3
@jentheo
jentheo / exclude-categories-all-views.php
Last active October 10, 2017 21:58
Exclude certain categories from all views (except category pages)
<?php
/*
* The Events Calendar Remove Events from All Views (Except Category Pages)
* add to theme's functions.php file
* @version 4.5.5
* replace these example slugs with your event category slugs: array( 'family-fun', 'bbq' )
*/
add_action( 'pre_get_posts', 'tribe_exclude_events_categories_all_views' );
@jentheo
jentheo / city-query.php
Last active October 17, 2017 21:09
Query only events in Frankfurt
<?php
//Retrieve venues that match query criteria
$args = array(
'nopaging' => true,
'post_type'=>'tribe_venue',
//Only query venues in Frankfurt
'meta_query' => array(
array(
'key' => '_VenueCity',
'value' => array( 'Frankfurt'),