Skip to content

Instantly share code, notes, and snippets.

View barryhughes's full-sized avatar

Barry Hughes barryhughes

  • Automattic
  • Vancouver Island, Canada
View GitHub Profile
@barryhughes
barryhughes / single-event.php
Created November 29, 2017 22:54
Modified version of the single-event.php template (for TEC 4.6.3 → 4.6.6)
<?php
/**
* Modified single event template.
*
* This deviates from the default template by capturing the previous and next
* event link HTML and re-using it, preventing the same queries from running
* twice unnecessarily.
*
* @version 4.6.3
*/
@barryhughes
barryhughes / wpseo-tec-mobile-view-compat.php
Created November 22, 2017 22:56
Quick hack to resolve a conflict/integration issue between WP SEO and The Events Calendar re mobile view settings and navigation
<?php
/**
* Temporary workaround to try and ensure the default mobile
* view is respected and that switching between views is possible
* when TEC is running alongside WP SEO.
*
* Tested with:
*
* - The Events Calendar 4.6.6
* - WordPress SEO 5.8
@barryhughes
barryhughes / temp-fix-ecp-embedded-photo-view-avada.php
Last active February 6, 2018 20:59
Can be used to resolve a conflict caused by ECP and Avada adding two different versions of the same library (Isotope)
<?php
/**
* Temporary fix for an Isotope conflict between Events Calendar PRO
* and Avada, when the [tribe_events] shortcode is used to embed
* photo view.
*
* Tested with Events Calendar PRO 4.4.19
* and Avada 5.3.0.
*/
add_action( 'tribe_events_pro_tribe_events_shortcode_prepare_photo', function() {
@barryhughes
barryhughes / force-merge-button.tec.4.6.3.php
Created November 2, 2017 21:10
Force the merge duplicate venues and organizers button to appear (The Events Calendar 4.6: Events > Settings > General screen)
<?php
/**
* Force the merge duplicate venue/organizer button to appear.
*
* Written for TEC 4.6.3, may or may not work with other versions.
*
* @param mixed $value
* @param mixed $default
* @param string $key
*
@barryhughes
barryhughes / ea-event-timezone-modifier.php
Last active November 1, 2017 23:06
Modifies the timezone of imported events (useful if for example the source feed is always UTC, but we wish to convert to some other timezone upon initial import)
<?php
class Imported_Events_Timezone_Modifier {
protected $source;
protected $target_timezone;
public function __construct( $source, $target_timezone ) {
$this->source = $source;
$this->target_timezone = $target_timezone;
}
@barryhughes
barryhughes / drop-db-tables.wp.php
Created September 12, 2017 21:38
Helper script to drop a bunch of imported tables from a WP test site.
<?php
/**
* Drop a bunch of tables.
*
* Update the prefix in the foreach definition then run via WP-CLI,
* ie "wp eval-file ../path/to/this-script.php".
*/
global $wpdb;
foreach ( $wpdb->get_col( "SHOW TABLES LIKE 'customer_db_%'" ) as $table ) {
@barryhughes
barryhughes / taxonomy.php
Created July 25, 2017 19:13
Replacement with categories/tags as checkboxes and hierarchical indents
<?php
// Don't load directly
defined( 'WPINC' ) or die;
$selected_terms = array();
$taxonomy_obj = get_taxonomy( $taxonomy );
$ajax_args = array(
'taxonomy' => $taxonomy,
);
@barryhughes
barryhughes / tickets.php
Created July 24, 2017 20:30
Replacement for eddtickets/tickets.php
<?php
/**
* Override for the standard EDD tickets form. Please create this at:
*
* [your-theme]/tribe-events/eddtickets/tickets.php
*
* @var bool $must_login
*/
global $edd_options;