Skip to content

Instantly share code, notes, and snippets.

@theeventscalendar
theeventscalendar / auto publish events from users.php
Created June 16, 2015 20:25 — forked from caseydriscoll/functions.php
Auto-publishes events submitted by logged in users
//Add to functions.php of your active theme
add_filter( 'tribe_events_community_sanitize_submission', 'set_community_events_publication_status' );
function set_community_events_publication_status( $submission ) {
// Escape, assuming default is set to 'draft' and 'allow anonymous submits'
if ( ! is_user_logged_in() ) return $submission;
$submission['post_status'] = 'publish';
return $submission;
}
@theeventscalendar
theeventscalendar / default month.php
Last active May 7, 2020 13:24 — forked from elimn/tribe_set_default_date.php
Show a default month or date range in the calendar
<?php
/**
* Sets the default date for event queries.
*
* Expects to be called during tribe_events_pre_get_posts. Note that this
* function modifies $_REQUEST - this is needed for consistency because
* various parts of TEC inspect that array directly to determine the current
* date.
*
@theeventscalendar
theeventscalendar / events in main loop by publish date.php
Last active August 29, 2015 14:23 — forked from anonymous/revised.php
Orders events in your main blog loop by the event publish date instead of the event date.
add_action( 'pre_get_posts', 'tribe_post_date_ordering', 51 );
function tribe_post_date_ordering( $query ) {
if ( ! empty( $query->tribe_is_multi_posttype ) ) {
remove_filter( 'posts_fields', array( 'Tribe__Events__Query', 'multi_type_posts_fields' ) );
$query->set( 'order', 'DESC' );
}
}
@theeventscalendar
theeventscalendar / callable phone numbers.php
Created June 24, 2015 22:45 — forked from geoffgraham/gist:011974ea4d1df5551e1a
Make venue and organizer phone numbers into callable links
// Link the Venue Phone Number
add_filter( 'tribe_get_phone', 'filter_link_the_phone' );
function filter_link_the_phone( $phone ) {
return '<a href="tel:' . $phone . '">' . $phone . '</a>';
}
// Link the Organizer Phone Number
add_filter( 'tribe_get_organizer_phone', 'filter_link_the_organizer_phone' );
function filter_link_the_organizer_phone( $phone ) {
return '<a href="tel:' . $phone . '">' . $phone . '</a>';
@theeventscalendar
theeventscalendar / org-email-mailto.php
Created July 7, 2015 21:55 — forked from barryhughes/live-click-org-email.php
Makes the Organizer email a mailto link on single event pages
/**
* Convert organizer emails into live "mailto:" links that users can click on.
*
* @param $email
* @return string
*/
function organizer_live_email_link( $email ) {
if ( ! is_email( $email ) || ! is_singular( Tribe__Events__Main::POSTTYPE ) ) return $email;
return '<a href="mailto:' . esc_attr( $email ) . '">' . esc_html( $email ) . '</a>';
}
@theeventscalendar
theeventscalendar / show-phone-number-attendees-list.php
Last active August 29, 2015 14:24
Show the purchaser's phone number in the Tickets attendee list.
if ( function_exists( 'tribe_is_event') ) {
/**
* Adds the phone number to the "Purchaser Email" column.
* @link http://theeventscalendar.com/support/forums/topic/add-attendee-telephone-number-to-attendee-list/
*/
function tribe_953653_add_phone_to_attendee_list( $value, $item, $column ) {
// Change this column name to move the phone number to a different column.
if ( 'purchaser_email' != $column ) {
return $value;
<?php
$count = 0;
echo '<ul>';
foreach ( $tickets as $ticket ) {
global $product;
$count++;
if ( class_exists( 'WC_Product_Simple' ) ) $product = new WC_Product_Simple( $ticket->ID );
else $product = new WC_Product( $ticket->ID );
@theeventscalendar
theeventscalendar / link-directly-to-website-url.php
Last active January 15, 2019 19:55 — forked from elimn/tribe_set_link_website.php
Change event or venue links in The Events Calendar to the relevant website URL
@theeventscalendar
theeventscalendar / past-event-reverse-order.php
Created August 10, 2015 22:55 — forked from elimn/functions.php
Change past event views to reverse chronological order
<?php
// Changes past event views to reverse chronological order
function tribe_past_reverse_chronological ($post_object) {
$past_ajax = (defined( 'DOING_AJAX' ) && DOING_AJAX && $_REQUEST['tribe_event_display'] === 'past') ? true : false;
if(tribe_is_past() || $past_ajax) {
$post_object = array_reverse($post_object);
}
@theeventscalendar
theeventscalendar / add-prev-next-links.php
Last active August 29, 2015 14:27 — forked from BeardedGinger/prevnext.php
Adds Previous/Next Month links to Month View even when no future/past events exist