Skip to content

Instantly share code, notes, and snippets.

@GeoffEW
GeoffEW / fix_for_blurry_phot_view.php
Created January 22, 2019 16:10
Fix for blurry images in the Photo view
<?php
// Fix blurry photo image #jrfm
// To use in functions.php without the PHP opening tag at the top :-)
function tribe_adjust_photo_view_image_size($unfiltered) {
if ( tribe_is_photo() ) {
$filtered = get_the_post_thumbnail( get_the_ID(), 'full' );
@GeoffEW
GeoffEW / single-event.php
Created February 8, 2018 19:35
Adds the list of all recurrences to the single event view
<?php
/* Add this code within the single-event.php template */
if ( function_exists( 'cwd_display_recurring_events' ) ) {
global $post;
echo cwd_display_recurring_events( $post );
}
function cwd_display_recurring_events( $post ) {
@GeoffEW
GeoffEW / nextrecurrence.php
Created October 7, 2016 01:32
Retrieves the next upcoming recurrence for a given post ID
<?php
/**
* Retrieves the next upcoming recurrence for a given post ID
*
* @param int $event_id The post ID for the event
*
* @return WP_Post|null The event post object, or null if nothing was found
*/
function tribe_get_next_upcoming_recurrence( $event_id ) {
@GeoffEW
GeoffEW / remove_recurring_ticket.php
Created October 20, 2016 17:49
remove tickets form for recurring instances other than the first
<?php
/* Tribe, remove tickets form for recurring instances other than the first */
function tribe_remove_tickets_from_recurring_instances ( ) {
global $post;
// bail if The Events Calendar or Event Tickets Plus are not active
if ( !class_exists( 'Tribe__Events__Main' ) || !class_exists('Tribe__Tickets_Plus__Commerce__WooCommerce__Main') ) return false;
@GeoffEW
GeoffEW / details_with_recurrence_info.php
Created November 16, 2016 06:41
Add recurring rules to the details section
<?php
<?php
/**
* Single Event Meta (Details) Template
*
* Override this template in your own theme by creating a file at:
* [your-theme]/tribe-events/modules/meta/details.php
*
* @package TribeEventsCalendar
*/
@GeoffEW
GeoffEW / hide_single_cost.php
Created January 27, 2017 01:39
Hides cost from the single event details section
<?php
/**
* Hides cost from the single event details section
*
* @param string $tpl Template relative path
*/
function tribe_single_hide_cost( $tpl ) {
if ( 'modules/meta/details.php' === $tpl ) {
add_filter( 'tribe_get_formatted_cost', '__return_empty_string' );
@GeoffEW
GeoffEW / change_rsvpstrings.php
Created February 14, 2017 06:33
/* Additional functions for changing strings in the events calendar and its plugins * See https://theeventscalendar.com/knowledgebase/change-the-wording-of-any-bit-of-text-or-string/ for details * on the provided functions by the TEC team * 1. - function for changing quantity based spelling * 2. - function for changing strings with an attached c…
<?php
/* Additional functions for changing strings in the events calendar and its plugins
* See https://theeventscalendar.com/knowledgebase/change-the-wording-of-any-bit-of-text-or-string/ for details
* on the provided functions by the TEC team
* 1. - function for changing quantity based spelling
* 2. - function for changing strings with an attached context
*/
function tribe_custom_theme_numbered_text ( $translation, $single, $plural, $number, $domain ) {
@GeoffEW
GeoffEW / Remove_free_price_range.php
Created February 17, 2017 22:25
Advanced version of the remove free snippet
<?php add_filter ( 'tribe_get_cost', 'tribe_not_show_free', 10, 3 );
function tribe_not_show_free ( $cost, $post_id, $with_currency_symbol ) {
if ( $cost == 0 || $cost == 'Free' ) {
$cost = str_replace('Free', '', $cost);
$cost = str_replace(' - ', '', $cost);
}
return $cost;
}
@GeoffEW
GeoffEW / hide_cost_recurring.php
Created February 22, 2017 08:05
/* Tribe, hide cost for recurring instances other than the first */
<?php
/* Tribe, hide cost for recurring instances other than the first */
function tribe_hide_cost_for_recurring_instances ( $cost, $post_id, $with_currency_symbol ) {
$event = tribe_events_get_event( $post_id );
if ( $event->post_parent > 0 ) {
$cost = '';
}
@GeoffEW
GeoffEW / remove_child_photo.php
Created May 18, 2017 05:51
Tribe, remove child recurring events from photo view
<?php
/* Tribe, remove child recurring events from photo view */
function tribe_set_default_date ( $query ) {
if ( tribe_is_photo() ) {
$query->set( 'post_parent', '0' );
}
}
add_action( 'pre_get_posts', 'tribe_set_default_date', 15 );