Created
October 15, 2015 15:01
-
-
Save jesseeproductions/4df22b491f0604be0ddc to your computer and use it in GitHub Desktop.
The Events Calendar - WooCommerce Tickets - Add Event Title to Product Title
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 Events Calendar - WooCommerce Tickets - Add Event Title to Product Title | |
| * add coding to theme's functions.php | |
| * @version 3.12 | |
| */ | |
| add_filter( 'woocommerce_product_title', 'tribe_add_event_title_to_tickets_title', 10 , 2 ); | |
| function tribe_add_event_title_to_tickets_title( $title, $product ) { | |
| $product_id = $product->id; | |
| $event_id = get_post_meta($product_id , '_tribe_wooticket_for_event', true ); | |
| $event_title = ''; | |
| if ( $event_id ) { | |
| $event_title = ' - ' . get_the_title( $event_title ); | |
| } | |
| return $title . $event_title; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment