Created
January 25, 2015 02:21
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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