Custom code on Events Calendar 3.11.2

Home Forums Calendar Products Events Calendar PRO Custom code on Events Calendar 3.11.2

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #994666
    Carl
    Participant

    Hello,

    I have the following custom code in my functions.php file for the Events Calendar as well as Tickets. Will it still work on Events Calendar 3.11.2?:

    remove_action( 'tribe_events_single_event_after_the_meta', array( TribeWooTickets::get_instance(), 'front_end_tickets_form'), 5 );
    add_action( 'tribe_events_single_event_after_the_content', array( TribeWooTickets::get_instance(), 'front_end_tickets_form'), 5 );
    
    // This example replaces "Event" with "Course" in all Tribe Plugins text
     
    // See the codex to learn more about WP text domains:
    // http://codex.wordpress.org/Translating_WordPress#Localization_Technology
    // Example Tribe domains: 'tribe-events-calendar', 'tribe-events-calendar-pro'...
     
    add_filter('gettext', 'theme_filter_text', 10, 3);
     
    function theme_filter_text( $translations, $text, $domain ) {
     // If this text domain starts with "tribe-"
     if(strpos($domain, 'tribe-') === 0) {
     // Replace upper case, lower case, singular, and plural
     $text = str_replace(
     // Text to search for
     array('Event', 'event', 'Events', 'events'),
     
     // Text to replace it with -- change this for your needs
     array('Course', 'course', 'Courses', 'courses'),
     $text
     );
     
     }
     
     return $text;
    }
     
    add_filter('ngettext', 'theme_filter_ntext', 10, 5);
     
    function theme_filter_ntext( $translation, $single, $plural, $number, $domain ) {
     // If this text domain starts with "tribe-"
     if(strpos($domain, 'tribe-') === 0) {
     // Replace upper case, lower case, singular, and plural
     if( $number > 1 ) {
     $plural = str_replace(
     // Text to search for
     array('Events', 'events'),
     
     // Text to replace it with -- change this for your needs
     array('Courses', 'courses'),
     $plural
     );
     
     return $plural;
     } else {
     $single = str_replace(
     // Text to search for
     array('Event', 'event'),
     
     // Text to replace it with -- change this for your needs
     array('Course', 'course'),
     $single
     );
     
     return $single;
     }
     }
    }
    
    add_filter( 'wootickets_email_message', 'replace_wootickets_order_msg' );
     
    function replace_wootickets_order_msg() {
        return '';
    }
    
    add_action( 'init', 'stop_wootickets_ticket_email' );
     
    function stop_wootickets_ticket_email() {
        $callback = array( TribeWooTickets::get_instance(), 'add_email_class_to_woocommerce' );
        remove_filter( 'woocommerce_email_classes', $callback );
    }
    
    #994761
    Brian
    Member

    Hi,

    Thanks for using our plugins.

    I tested out the coding and it works with this change: (there is 3 places I saw that class name)

    TribeWooTickets

    Should be changed to this:

    Tribe__Events__Tickets__Woo__Main

    Here is what I saw too.

    The words Event or Events changed to Course or Courses.

    The Ticket Form Moved Up

    The Order email did not have a message about tickets sent in another email. Nor did any ticket emails get sent on my test order.

    So it looks like you are all set once you change the class name after updating.

    I would test on your site after the update and class name changes just to make sure.

    Cheers

    #994766
    Carl
    Participant

    Hi Brian,

    Thanks for responding so promptly.

    Just to double check do you mean the following code should be changed:

    add_action( 'init', 'stop_wootickets_ticket_email' );
      
    function stop_wootickets_ticket_email() {
        $callback = array( TribeWooTickets::get_instance(), 'add_email_class_to_woocommerce' );
        remove_filter( 'woocommerce_email_classes', $callback );
    }

    `add_action( ‘init’, ‘stop_wootickets_ticket_email’ );

    function stop_wootickets_ticket_email() {
    $callback = array( Tribe__Events__Tickets__Woo__Main::get_instance(), ‘add_email_class_to_woocommerce’ );
    remove_filter( ‘woocommerce_email_classes’, $callback );
    }

    • This reply was modified 10 years, 8 months ago by Carl.
    #994842
    Brian
    Member

    Yep that is correct.

    And these two should be changed too:

    remove_action( 'tribe_events_single_event_after_the_meta', array( Tribe__Events__Tickets__Woo__Main::get_instance(), 'front_end_tickets_form'), 5 );
    add_action( 'tribe_events_single_event_after_the_content', array( Tribe__Events__Tickets__Woo__Main::get_instance(), 'front_end_tickets_form'), 5 );

    #995322
    Carl
    Participant

    Thanks Brian

    #995413
    Brian
    Member

    You’re Welcome.

    #999529
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Custom code on Events Calendar 3.11.2’ is closed to new replies.