Skip to content

Instantly share code, notes, and snippets.

@GeoffEW
GeoffEW / JSON_remove.php
Created July 13, 2016 01:44
Remove JSON LD from month view (performance temp fix)
<?php
/**
* Removes json LD from loading on month view
*/
function tribe_run_on_init( ) {
global $wp_filter;
if( tribe_is_month() ) {
@GeoffEW
GeoffEW / trigger-recurrence-rebuild.php
Last active August 13, 2016 02:25
Rebuilds child posts
<?php
/*
* Deletes the saved copy of "deleted" events generated by iCal Importer
* This allows you to re-import events. The script deletes 50 instances per page load
* Code by Nico; enhancement by Andras
*/
function del_deleted_events () {
$posts = get_posts( array( 'post_type'=>'deleted_event', "posts_per_page" => 50, 'post_status' => 'trash', ) );
if (!empty($posts)) {
foreach ($posts as $post) {
@GeoffEW
GeoffEW / clean_deleted_events.php
Last active August 30, 2016 02:53
Deletes the saved copy of "deleted" events generated by iCal Importer
<?php
/*
* Deletes the saved copy of "deleted" events generated by iCal Importer
* This allows you to re-import events. The script deletes 50 instances per page load
* Code by Nico; enhancement by Andras
*/
function del_deleted_events () {
$posts = get_posts( array( 'post_type'=>'deleted_event', "posts_per_page" => 50, 'post_status' => 'trash', ) );
if (!empty($posts)) {
foreach ($posts as $post) {
@GeoffEW
GeoffEW / new_order_xtrainfo.php
Created July 21, 2016 19:03
Adds ticketed event information to WooCommerce "order confirmation" emails.
<?php
/**
* Adds ticketed event information to WooCommerce "order confirmation" emails.
*
* @param object $order
* @param bool $sent_to_admin
* @return void
*/
function add_attending_events_above_woo_order_info( $order, $sent_to_admin ) {
$line_items = $order->get_items( apply_filters( 'woocommerce_admin_order_item_types', 'line_item' ) );
@GeoffEW
GeoffEW / force_cost.php
Created July 27, 2016 17:24
/* Force the use of the cost field of event and ignore tickets price */
<?php
/* Force the use of the cost field of event and ignore tickets price */
function tribe_just_show_price_field ( $cost, $post_id, $with_currency_symbol ) {
$cost_utils = Tribe__Events__Cost_Utils::instance();
$cost = tribe_get_event_meta( $post_id, '_EventCost' );
if ( $with_currency_symbol ) {
$cost = $cost_utils->maybe_format_with_currency( $cost );
@GeoffEW
GeoffEW / Delete_Recurrence.txt
Created August 2, 2016 18:55
This SQL Query will delete all recurrences of an event
/*
This SQL Query will delete all recurrences of an event, while preserving the
original event. It can delete many thousands of recurrences per second on most
servers.
The query and steps below is modified version of that in this tutorial:
http://wpguru.co.uk/2013/02/how-to-bulk-delete-posts-in-wordpress-with-mysql/
It is recommended that you read the source article above before proceeding.
Step 1) Grab the "post_parent" ID for your recurring series of events. Navigate
@GeoffEW
GeoffEW / change_rsvp_label_CT.php
Created August 10, 2016 21:29
Replaces label for RSVP tickets in the radio button selector in the Community Tickets front-end "Add ticket" interface
<?php
function change_rsvp_label() { ?>
<script>
jQuery(document).ready( function ( ){
jQuery('input[value="Tribe__Tickets__RSVP"]').next().html('Free Tickets');
<?php
// Put your custom text here in a key => value pair
// Example: 'Text you want to change' => 'This is what it will be changed to'
// The text you want to change is the key, and it is case-sensitive
// The text you want to change it to is the value
// You can freely add or remove key => values, but make sure to separate them with a comma
// This example changes the label "Venue" to "Location", and "Related Events" to "Similar Events"
$custom_text = array(
'Events' => 'Bananas',
'Event' => 'Banana',
<?php
/**
* Plugin name: ET Meta Hawk
* Description: Lets site administrators soar over meta data supplied by attendees then swoop down, hawk-like, to change it. Proof of concept targeting the WooCommerce provider.
* Version: 2016-03-21
*
* Experiment in making attendee meta editable via the attendee screen.
* Well worth bearing in mind that:
*
* - It currently won't work for RSVP or providers besides WooCommerce
<?php
/*
* The Events Calendar Pro - Hide Mini Calendar Event List Until Calendar Date is Clicked
* TEC PRO @3.11.1
*/
add_action( 'wp_footer', 'tribe_hide_mini_calendar_list_until_clicked', 50 );
function tribe_hide_mini_calendar_list_until_clicked() {
?>
<script>
var $ = jQuery.noConflict();