Instantly share code, notes, and snippets.

View functions.php
<?php
/**
* Pseudo code for putting the WooCommerce Bookings Form anywhere, such as via a shortcode.
* !!! READ THE CODE COMMENTS !!!
*
* @link http://ideas.woocommerce.com/forums/133476-woocommerce/suggestions/34526179-creating-shortcode-booking-search-form-with-date-r
*
* @see WC_Booking_Cart_Manager::add_to_cart()
*
View functions.php
<?php
/**
* Events Calendar PRO: Add {pro_addl_fields} variable to the tribe_event_inline shortcode.
*
* @see cliff_render_pro_addl_fields_within_inline_shortcode()
*
* @link https://gist.github.com/cliffordp/376e8c204ccd34ec78fbc38d519350ef This snippet.
* @link https://theeventscalendar.com/knowledgebase/embedding-single-events-tribe_event_inline-shortcode/
* @link https://theeventscalendar.com/knowledgebase/pro-additional-fields/
*/
View functions.php
<?php
/**
* The Events Calendar (TEC) and WooCommerce: Add TEC's taxonomy to Products post type.
*
* @link https://gist.github.com/cliffordp/94033d6d1558a84fa9a3214e1f850cda This snippet.
*/
function cliff_add_tec_cat_to_woo_products( $taxonomy, $object_type ) {
if (
! class_exists( 'Tribe__Events__Main' )
|| Tribe__Events__Main::TAXONOMY !== $taxonomy
View functions.php
<?php
/**
* The Events Calendar (TEC) and Event Aggregator (EA): Add further-future import limits.
*
* @link https://gist.github.com/cliffordp/7e687ec1d1cd7d89d2fa05af5b595d1f This snippet.
*
* @see \Tribe__Events__Aggregator__Settings::get_range_options()
*/
function cliff_ea_add_further_future_import_range_options( $options ) {
// Add months 4-11
View examples.php
<?php
/**
* Usage examples that require https://github.com/cliffordp/gf-gw-req-char-length version 2.0.0+.
*
* This gist's changelog:
*
* Version 1.0.0 - October 26, 2018
* - Initial version of this gist example.
*/
View functions.php
<?php
/**
* The Events Calendar (TEC) and Event Aggregator (EA): Link Site B's imported TEC events to their canonical Event
* Tickets location on Site A. Displays a big button on Site B's single events pages.
*
* Useful when you want to import and display Site A's events (running TEC and ET/ET+) on Site B (running TEC and EA).
* WARNING: Watch out if you're also importing from other sources, like Google, Eventbrite, etc.
* Read this snippet's code comments to make sure you understand what this code does and what it does not do.
*
* @link https://gist.github.com/cliffordp/aab5ea85e9bd409d09cb8e22a3690a25 This snippet.
View gf_entries_october_nonadmin.php
<?php
$admin_users = get_users( [ 'role' => 'administrator' ] );
$admin_user_ids = wp_list_pluck( $admin_users, 'ID' );
$entries_search = [
'status' => 'active', // non-trashed entries
'start_date' => '2018-10-01 00:00:00', // October 1
'end_date' => '2018-10-31 23:59:59', // October 31
'field_filters' => [
[
View private-debug-log.php
<?php
/*
Plugin Name: Private Debug Log
Description: Enable debug log to a private folder not accessible from the web
Version: 0.0.1
Author: WebAware
Author URI: http://www.webaware.com.au/
*/
/*
View functions.php
<?php
/**
* The Events Calendar & Event Tickets Plus (ET+): Disable QR Code if ticket is for an event in a specific category.
*
* Requires ET+ 4.8.2 or later (when this filter was added).
* Useful for events where there is no physical check-in required, such as an online event or webinar.
*
* @link https://gist.github.com/cliffordp/7a819ccf8343cc19a07fd74b9f9aa762 This snippet.
*
* @param bool $enabled The bool that comes from the options.
View gravityview-modify-caps-by-id.php
<?php
// Forked from gist linked at https://docs.gravityview.co/article/311-gravityview-capabilities
/**
* Modify whether an user has access to edit a specific View.
*
* @see https://codex.wordpress.org/Plugin_API/Filter_Reference/user_has_cap
*
* @param array $allcaps All the capabilities of the user