Skip to content

Instantly share code, notes, and snippets.

@GeoffEW
GeoffEW / merge_venue.php
Created April 17, 2017 23:50
Tribe, merge venues
<?php
/* Tribe, merge venues util function */
function merge_venues ( $venue_id, $merge_venues ) {
// let's check the venues_id is valid
if ( !tribe_is_venue( $venue_id ) ) return;
foreach ( $merge_venues as $merge_venue ) {
@GeoffEW
GeoffEW / force_cost_ce.php
Created April 14, 2017 06:15
Force the display of the cost field of event on the Community Events submit form
<?php
/* Force the display of the cost field of event on the Community Events submit form */
add_filter( 'tribe_events_community_display_cost_section', '__return_true', 100 );
@GeoffEW
GeoffEW / Change_related.php
Created April 11, 2017 06:28
/* Tribe, change related posts arguments */
@GeoffEW
GeoffEW / redirect_mobile.php
Created March 24, 2017 14:40
Redirect Mobile Users to List View
/*
* The Events Calendar - Redirect Mobile Users to List View
*/
add_action( 'template_redirect', 'tec_mobile_template_redirect' );
function tec_mobile_template_redirect() {
if( tribe_is_week() && wp_is_mobile() ) {
wp_redirect( tribe_get_listview_link() );
exit();
}
}
<?php
/* Tribe, limit ticket qty */
function tribe_limit_tickets() {
?>
<script type="text/javascript">
jQuery(document).ready( function( $ ) {
// do this if tickets available
if ( $('.tribe-events-tickets').length ) {
// set max qty to 1
@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_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 / 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 / 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 / prevent_export.php
Last active October 2, 2022 15:15
Prevent calendar export links from showing anywhere on the front-end.
<?php
/**
* Prevent calendar export links from showing anywhere on the front-end.
*
*
*/
class Tribe__Events__Remove__Export__Links {
public function __construct() {
add_action( 'init', array( $this, 'single_event_links' ) );