An example of how to import custom fields (in this case a subtitle) during with the ActiveTickets import, using the Theater for Wordpress plugin. You can show the subtitle in your listings like this: `[wpt_events]{{title|permalink}}{{subtitle}}[/wpt_events].
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 | |
/** | |
* Adds the subtitle ActiveTickets field to a production on import. | |
* | |
* You can show the subtitle in your listings like this: | |
* [wpt_events]{{title|permalink}}{{subtitle}}[/wpt_events] | |
* | |
* You can add the subtitle to your template like this: | |
* $production = new WPT_Production(); | |
* echo $production->custom('subtitle'); | |
* | |
* @param WPT_Production $production The production. | |
* @param object $activetickets_program The production data coming from the ActiveTickets feed. | |
* @return void | |
*/ | |
function add_activetickets_subtitle_to_production($production, $activetickets_program) { | |
$subtitle = (string) $activetickets_program->SubTitle; | |
if (!empty($subtitle)) { | |
update_post_meta($production->ID, 'subtitle', $subtitle); | |
} | |
} | |
add_filter('wpt_activetickets_import/create_production', 'add_activetickets_subtitle_to_production', 10 ,2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment