This file contains hidden or 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
| function tec_1163154_dequeue_gmaps_script() { | |
| if ( ! class_exists( 'Tribe__Events__Main' ) ) { | |
| return false; | |
| } | |
| $tecmain = Tribe__Events__Main::instance(); | |
| if ( | |
| // https://developer.wordpress.org/reference/functions/is_post_type_archive/ |
This file contains hidden or 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
| /** | |
| * Automatically set event categories as post categories for the Events Calendar. | |
| */ | |
| function set_event_categories_as_post_categories( $post_id ) { | |
| // Check if the post is an event post type | |
| if ( 'tribe_events' === get_post_type( $post_id ) ) { | |
| // Get the event categories | |
| $event_categories = wp_get_post_terms( $post_id, 'tribe_events_cat', array( 'fields' => 'names' ) ); | |
| // Set event categories as post categories |
This file contains hidden or 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
| /*The Tribe Events Calendar plugin for WordPress provides several functions to retrieve information about events and their tickets. While there isn't a specific function to differentiate between paid/free tickets and RSVPs, you can use a combination of functions to achieve the desired result. | |
| To determine if an event has tickets or is only based on RSVP, you can use the following approach: | |
| Use the tribe_get_event_meta() function to retrieve the event's ticketing meta information. This function returns an array containing various details about the event, including ticketing information. | |
| Check if the event has any tickets by accessing the 'tribe_tickets' key in the returned array. If it exists and is not empty, it indicates that the event has tickets. | |
| If the event has tickets, you can further examine the ticket types to determine if they are paid or free. You can use the tribe_get_ticket_types() function to retrieve an array of ticket types for the event. | |
| Iterate through the ticket types array and check the |
This file contains hidden or 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
| function custom_event_permalink_structure($permalink, $post, $leavename) { | |
| // Check if the post type is 'tribe_events' | |
| if ($post->post_type === 'tribe_events') { | |
| // Get the categories assigned to the event | |
| $categories = get_the_terms($post->ID, 'tribe_events_cat'); | |
| // Check if categories are available | |
| if ($categories && !is_wp_error($categories)) { | |
| $category = reset($categories); // Get the first category | |
| $category_name = $category->slug; |
This file contains hidden or 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
| // Add category to all events | |
| function add_category_to_all_events() { | |
| // Get all events | |
| $events = get_posts(array( | |
| 'post_type' => 'tribe_events', | |
| 'posts_per_page' => -1, // Get all events | |
| )); | |
| // Check if events are found | |
| if ($events) { |
This file contains hidden or 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
| /** | |
| * Example for adding event data to WooCommerce checkout for Events Calendar tickets. | |
| * | |
| */ | |
| add_filter('woocommerce_cart_item_name', 'woocommerce_cart_item_name_event_title', 10, 3); | |
| function woocommerce_cart_item_name_event_title($title, $values, $cart_item_key) { | |
| // Check if the product is an Events Calendar ticket | |
| $product_id = isset($values['product_id']) ? $values['product_id'] : null; |
This file contains hidden or 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
| add_filter( 'tribe_tickets_plus_attendee_registration_iac_fields', 'modify_attendee_fields' ); | |
| function modify_attendee_fields( $fields ) { | |
| // Check if 'Name' field exists before modifying | |
| if ( isset( $fields['name'] ) ) { | |
| $fields['name']['label'] = 'First Name'; // Change label to 'First Name' | |
| } | |
| // Optionally, you can add other modifications here | |
| // For example, changing placeholder text: |
This file contains hidden or 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 //Do not copy this line | |
| add_filter( 'tribe_tickets_plus_attendee_registration_iac_fields', 'modify_attendee_fields' ); | |
| function modify_attendee_fields( $fields ) { | |
| // Check if 'Name' field exists before modifying | |
| if ( isset( $fields['name'] ) ) { | |
| $fields['name']['label'] = 'First Name'; // Change label to 'First Name' | |
| } | |
| // Optionally, you can add other modifications here |
This file contains hidden or 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
| /** | |
| * Insert virtual event meeting URL and organizer link at the end of the description. | |
| * | |
| * @param array $item Array of items describing the event in ical format. | |
| * @param object $event The event object. | |
| * | |
| * @return array | |
| */ | |
| add_filter( 'tribe_ical_feed_item', function ( $item, $event ) { | |
| // Append virtual meeting URL if it exists |
This file contains hidden or 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 | |
| //* Do NOT include the opening php tag | |
| /** | |
| * If you want the BCC added to all ticket-related emails, regardless of type. | |
| * Useful for broader email handling, especially if your organization manages multiple ticket types. | |
| */ | |
| add_filter( 'tribe_tickets_email_headers', function( $headers, $ticket_id ) { |