Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Register a shortcode that can be embedded in pages/posts and will generate
- * the Woo Tickets form and potentially the ticket forms for any other plugin
- * using the same framework.
- */
- add_shortcode('wooticketform', 'wooticketshortcode');
- /**
- * Handler for the wooticketform shortcode. Usage is:
- *
- * [wooticketform eventid="123"]
- *
- * Where 123 is the post ID of the event you are selling tickets to.
- *
- * @param $args
- * @return string
- */
- function wooticketshortcode($args) {
- if (!isset($args['eventid'])) return '';
- // We're going to meddle with the post global
- $original_post = $GLOBALS['post'];
- $GLOBALS['post'] = get_post($args['eventid']);
- // Get the ticket form (we may end up with an empty string if nothing has
- // been setup or the wrong ID was specified)
- ob_start();
- tribe_get_ticket_form();
- $form = ob_get_clean();
- // Clean up and return the form
- $GLOBALS['post'] = $original_post;
- return $form;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement