Import extra fields from Z-Tickets object ( productions, shows ) to Theater object ( events, event dates ).
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 | |
/** | |
* Imports extra fields from Z-Tickets object ( productions, shows ) to Theater object ( events, event dates ). | |
* | |
* @param WPT_Production|WPT_Event $theater_object | |
* @param object $ztickets_object | |
* @return void | |
*/ | |
function ztickets_import_extra_fields( $theater_object, $ztickets_object ) { | |
$extra_fields = array( 'released', 'maccsbox_code' ); | |
foreach( $extra_fields as $field ) { | |
if ( !property_exists( $ztickets_object, $field) ) { | |
continue; | |
} | |
update_post_meta( $theater_object->ID, $field, $ztickets_object->{ $field } ); | |
} | |
} | |
add_action( 'theater/ztickets/import/process/production', 'ztickets_import_extra_fields', 10, 2 ); | |
add_action( 'theater/ztickets/import/process/event', 'ztickets_import_extra_fields', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment