Skip to content

Instantly share code, notes, and snippets.

View cliffordp's full-sized avatar

Clifford cliffordp

View GitHub Profile
@cliffordp
cliffordp / functions.php
Created February 28, 2018 03:35 — forked from bordoni/functions.php
How to add the Venue on The Events Calendar Month Tooltip
<?php
/*
* If you already have something in your functions.php, please remove these first few lines
*/
function tec_forum_939516( $json, $event, $additional ){
$venue = tribe_get_venue_id( $event );
if ( $venue ){
$json['venue'] = $venue;
@cliffordp
cliffordp / customizer-links.php
Last active November 15, 2017 18:45 — forked from slushman/customizer-links.php
How to link into the WordPress Customizer
@cliffordp
cliffordp / tribe_neuter_qr.php
Last active April 2, 2021 19:29 — forked from elimn/tribe_neuter_qr.php
MT | TEC | Hide QR codes from the Email/Tickets sent to purchasers
<?php
/*
* Hides QR codes from the Email/Tickets sent to purchasers
* No longer needed as of https://theeventscalendar.com/maintenance-release-for-the-week-of-27-may-2018/
*/
function tribe_neuter_qr () {
if ( class_exists( 'Tribe__Tickets_Plus__Main' ) ) {
$qr_class = Tribe__Tickets_Plus__Main::instance()->qr();
remove_action( 'tribe_tickets_ticket_email_ticket_bottom', array( $qr_class, 'inject_qr' ) );
@cliffordp
cliffordp / force_balance_tags2.php
Created July 6, 2017 14:16 — forked from westonruter/force_balance_tags2.php
Use DOMDocument to do a more robust job at force_balance_tags.
<?php
/**
* Use DOMDocument to do a more robust job at force_balance_tags.
*
* "force_balance_tags() is not a really safe function. It doesn’t use an HTML parser
* but a bunch of potentially expensive regular expressions. You should use it only if
* you control the length of the excerpt too. Otherwise you could run into memory issues
* or some obscure bugs." <http://wordpress.stackexchange.com/a/89169/8521>
*
@cliffordp
cliffordp / gist:15f49a82fcaeb62468ffbbcabf15d242
Created June 28, 2017 03:17 — forked from andphe/gist:3232343
Export your links from Safari reading list
/usr/bin/plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist | grep -E -o '<string>http[s]{0,1}://.*</string>' | grep -v icloud | sed -E 's/<\/{0,1}string>//g'
@cliffordp
cliffordp / tribe_embed_google_map_true.php
Last active June 17, 2017 01:52 — forked from elimn/tribe_embed_google_map_true.php
MT | TEC | Always show Google Map and Map Link on Single Events
<?php
/**
* Causes calendar to always show Google Map and Link, regardless of individual Event's or Venue's settings
*
* @link https://gist.github.com/cliffordp/d420a5f952ef3b91e6db2b4104b6f28b
*
* @see Tribe__Events__Main::tribe_embed_google_map()
* @see Tribe__Events__Main::tribe_show_google_map_link()
*/
@cliffordp
cliffordp / tribe_wootix_no_hijack.php
Created June 12, 2017 14:59 — forked from elimn/tribe_wootix_no_hijack.php
MT | TEC | Allows customers to access the WooCommerce product page for tickets
<?php
/*
* Causes WooCommerce Ticket product pages to stop redirecting to their event page
* See https://theeventscalendar.com/knowledgebase/selling-tickets-from-the-woocommerce-products-page/
*/
function tribe_wootix_no_hijack() {
if ( ! class_exists( 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main' ) ) return;
$woo_tickets = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance();
remove_filter( 'post_type_link', array( $woo_tickets, 'hijack_ticket_link' ), 10, 4 );
@cliffordp
cliffordp / custom-notice.php
Created April 28, 2017 20:01 — forked from geoffgraham/custom-notice.php
The Events Calendar 4.2 // Remove "This event has passed" notice on single-event.php in a specific category
// Removes the passed event notice for events in a speicifc category
add_filter( 'tribe_the_notices', 'customize_notice', 10, 2 );
function customize_notice( $html, $notices ) {
// If text is found in notice, then replace it
if (tribe_event_in_category('formation-sur-demande') && stristr( $html, 'This event has passed.' ) ) {
// Customize the message as needed
$html = str_replace( '', $html );
}
return $html;
@cliffordp
cliffordp / gist:67a8a57211bc922823acba226d1270d8
Created April 28, 2017 20:01 — forked from geoffgraham/gist:953930aefc0aa0fa2d28
The Events Calendar 4.3.3 // Customize "This Event Has Passed" notice
add_filter( 'tribe_the_notices', 'customize_notice', 10, 2 );
function customize_notice( $html, $notices ) {
// If text is found in notice, then replace it
if( stristr( $html, 'This event has passed.' ) ) {
// Customize the message as needed
$html = str_replace( 'This event has passed.', 'This event is gone but will not be forgotten.', $html );
}
return $html;
}
@cliffordp
cliffordp / event-view-url-slug-filter.php
Created April 28, 2017 13:14 — forked from barryhughes/event-view-url-slug-filter.php
Revision of custom event view slug snippet
<?php
/**
* Modify the "bases" used to form event URLs for various views.
*
* @param array $bases
*
* @return array
*/
function rename_event_view_slugs( $bases ) {
if ( isset( $bases['month'] ) ) $bases['month'] = [ 'calendar', 'calendar' ];