Safe way to use Tribe Functions

Home Forums Calendar Products Events Calendar PRO Safe way to use Tribe Functions

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #961109
    DAVE
    Participant

    Hi guys,

    When we write functions within a conditional like below it is fine, if however we deactivate the plugin, how is best to safeguard against errors?

    if( tribe_is_upcoming() || tribe_is_past() || tribe_is_map() || tribe_is_photo() ) {}

    Thanks.

    #961250
    Brian
    Member

    Hi Again,

    I can help out here.

    You can wrap your coding in checks such as this for The Events Calendar:

    if ( class_exists( 'TribeEvents' ) ) { //enter coding here }

    and for Pro:
    if ( class_exists( 'TribeEventsPro' ) ) { //enter coding here }

    That will only run only if those classes are active.

    Please note in 3.10 those classes will change to to Tribe__Events__Main and Tribe__Events__Pro__Main

    Let me know if that works for you.

    Thanks

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Safe way to use Tribe Functions’ is closed to new replies.