Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created July 26, 2012 15:12
Show Gist options
  • Save joshfeck/3182621 to your computer and use it in GitHub Desktop.
Save joshfeck/3182621 to your computer and use it in GitHub Desktop.
adds a new shortcode for printing a ticket quantity
function espresso_replace_ticket_shortcodes($content, $data) {
global $wpdb, $org_options;
$SearchValues = array(
//Attendee/Event Information
"[att_id]",
"[qr_code]",
"[gravatar]",
"[event_id]",
"[event_identifier]",
"[registration_id]",
"[registration_date]",
"[fname]",
"[lname]",
"[event_name]",
"[description]",
"[event_link]",
"[event_url]",
// new shortcode to display a quantity
"[ticket_quantity]",
//Payment details
"[cost]",
"[ticket_type]",
//Organization details
"[company]",
"[co_add1]",
"[co_add2]",
"[co_city]",
"[co_state]",
"[co_zip]",
//Dates
"[start_date]",
"[start_time]",
"[end_date]",
"[end_time]",
//Ticket data
"[ticket_content]",
//Logo
"[ticket_logo_url]",
"[ticket_logo_image]",
//Venue information
"[venue_title]",
"[venue_address]",
"[venue_address2]",
"[venue_city]",
"[venue_state]",
"[venue_zip]",
"[venue_country]",
"[venue_phone]",
"[venue_description]",
"[venue_website]",
"[venue_image]",
"[google_map_image]",
"[google_map_link]",
);
$ReplaceValues = array(
//Attendee/Event Information
$data->attendee->id,
$data->qr_code,
$data->gravatar,
$data->attendee->event_id,
$data->event->event_identifier,
$data->attendee->registration_id,
event_date_display($data->attendee->registration_date),
stripslashes_deep($data->attendee->fname),
stripslashes_deep($data->attendee->lname),
stripslashes_deep($data->event->event_name),
stripslashes_deep($data->event->event_desc),
$data->event_link,
$data->event_url,
//adds the quantity of tickets
$data->attendee->quantity > 1? ' (x '.$data->attendee->quantity.')':'',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment