Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created March 11, 2015 20:19
Show Gist options
  • Save joshfeck/87c38ee136b8fd2ca5b1 to your computer and use it in GitHub Desktop.
Save joshfeck/87c38ee136b8fd2ca5b1 to your computer and use it in GitHub Desktop.
An example of a custom template that can be used with Event Espresso 3's ticketing add-on
<?php
global $org_options;
//Build the path to the css files
if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . "tickets/templates/css/base.css")) {
$base_dir = EVENT_ESPRESSO_UPLOAD_URL . 'tickets/templates/css/';//If the template files have been moved to the uploads folder
} else {
$base_dir = ESPRESSO_TICKETING_FULL_URL.'templates/css/';//Default location
}
//Output the $data (array) variable that contains the attendee information and ticket settings
//echo "<pre>".print_r($data,true)."</pre>";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><?php echo stripslashes_deep($org_options['organization']) ?> <?php _e('Ticket for', 'event_espresso'); ?> <?php echo stripslashes_deep($data->attendee->fname . ' ' .$data->attendee->lname) ?> | <?php echo $data->attendee->registration_id ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Base Stylesheet do not change or remove -->
<link rel="stylesheet" type="text/css" href="<?php echo $base_dir; ?>base.css" media="screen" />
<!-- Primary Style Sheet -->
<link rel="stylesheet" type="text/css" href="<?php echo $base_dir.$data->event->css_file; ?>" />
<!-- Make sure the buttons don't print -->
<style type="text/css">
@media print{
.noPrint{display:none!important;}
}
</style>
</head>
<body>
<div class="outside">
<div class="print_button_div">
<form>
<input class="print_button noPrint" type="button" value=" Print Ticket " onclick="window.print();return false;" />
</form>
<form method="post" action="<?php echo espresso_ticket_url($data->attendee->id, $data->attendee->registration_id, '&pdf=true'); ?>" >
<input class="print_button noPrint" type="submit" value=" Download PDF " />
</form>
</div>
<div class="ticket">
<table width="100%" border="0">
<tr>
<td width="100%" height= "100px" valign="top" align="center">
<div class="logo">[ticket_logo_image]</div></td>
</tr>
<tr>
<td width="100%" align="center"><div class="qr_code">[qr_code]</div></td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" style="font-weight: bold; font-size: 14pt;">
[fname] [lname]<br>
</tr>
</table>
</div>
<div class="extra_info">
<div class="divider"></div>
<table width="100%" border="0">
<tr>
<td width="100%" align="left" valign="top">
<p>[ticket_content]</p></td>
</tr>
</table>
</div>
<div class="footer">Powered by the <a href="http://eventespresso.com" target="_blank">Event Espresso Ticketing System</a> for WordPress</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment