Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / post meta for organizer and venue pages.php
Last active August 29, 2015 14:22 — forked from barryhughes/single-org-venue-post-meta.php
Allows WP Custom Fields to show on the front end of Venue and Organizer pages
/**
* Outputs all WP post meta fields (except those prefixed "_"), feel
* free to tweak the formatting!
*/
function show_wp_custom_fields() {
foreach ( get_post_meta( get_the_ID() ) as $field => $value ) {
$field = trim( $field );
if ( is_array( $value ) ) $value = implode( ', ', $value );
if ( 0 === strpos( $field, '_' ) ) continue; // Don't expose "private" fields
echo '<strong>' . esc_html( $field ) . '</strong> ' . esc_html( $value ) . '<br/>';
@theeventscalendar
theeventscalendar / custom fields for venues.php
Created June 12, 2015 22:43 — forked from barryhughes/custom-fields-venues.php
Enable WP custom fields for venues
/**
* Enable custom field support for venue posts.
*
* @param array $args
* @return array
*/
function tribe_venues_custom_field_support( $args ) {
$args['supports'][] = 'custom-fields';
return $args;
}
@theeventscalendar
theeventscalendar / organizer custom fields.php
Last active August 29, 2015 14:22 — forked from barryhughes/org-custom-fields.php
Enables WP custom fields for organizers
/**
* Enable custom field support for organizer posts.
*
* @param array $args
* @return array
*/
function tribe_organizers_custom_field_support( $args ) {
$args['supports'][] = 'custom-fields';
return $args;
}
@theeventscalendar
theeventscalendar / list view default for categories.php
Last active December 13, 2019 15:06 — forked from barryhughes/use-list-view-for-categories.php
Category archive pages default to List View regardless of the default view set
/**
* Redirect event category requests to list view.
*
* @param $query
*/
function use_list_view_for_categories( $query ) {
// Disregard anything except a main archive query
if ( is_admin() || ! $query->is_main_query() || ! is_archive() ) return;
// We only want to catch *event* category requests being issued
@theeventscalendar
theeventscalendar / sample functions with changed text.php
Last active July 20, 2022 19:18 — forked from elimn/tribe_custom_theme_text.php
This is an example of a functions.php file with custom text added.
<?php
/*
* EXAMPLE OF CHANGING ANY TEXT (STRING) IN THE EVENTS CALENDAR
* See the codex to learn more about WP text domains:
* http://codex.wordpress.org/Translating_WordPress#Localization_Technology
* Example Tribe domains: 'tribe-events-calendar', 'tribe-events-calendar-pro'...
*/
function tribe_custom_theme_text ( $translation, $text, $domain ) {
@theeventscalendar
theeventscalendar / add CSS to Community Events pages
Created June 12, 2015 21:05 — forked from ckpicker/gist:b5cd24e28819181b5f7b
Use this snippet to add CSS to your 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
}
}