Skip to content

Instantly share code, notes, and snippets.

@slimndap
Last active August 29, 2015 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slimndap/6f1e069b795170061096 to your computer and use it in GitHub Desktop.
Save slimndap/6f1e069b795170061096 to your computer and use it in GitHub Desktop.
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].
<?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