Skip to content

Instantly share code, notes, and snippets.

@barryhughes
Created January 25, 2015 02:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barryhughes/a67b7415f1b60019a6a1 to your computer and use it in GitHub Desktop.
Save barryhughes/a67b7415f1b60019a6a1 to your computer and use it in GitHub Desktop.
Helpers/aliases to avoid notices when transitioning from TEC 3.9.x -> 3.10/4.x
<?php
/**
* Provides access to the main TEC object.
*
* @return TribeEvents|Tribe__Events__Events
*/
function prefix_get_event_instance() {
static $instance;
if ( ! isset( $instance ) && class_exists( 'Tribe__Events__Events' ) ) {
$instance = Tribe__Events__Events::instance();
}
elseif ( ! isset( $instance ) && class_exists( 'TribeEvents' ) ) {
$instance = TribeEvents::instance();
}
return $instance;
}
/**
* Provides notice-free access to TribeEvents/Tribe__Events__Events
* class constants, etc.
*/
if ( class_exists( 'Tribe__Events__Events' ) ) {
class Prefix_Event_Class extends Tribe__Events__Events {}
}
elseif ( class_exists( 'TribeEvents' ) ) {
class Prefix_Event_Class extends TribeEvents {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment