There are two key shortcodes available for My Tickets. There’s a basic shortcode to display the ‘Add to Cart’ form for a single event:

[ticket event='{ID}']

This shortcode is displayed in the settings when you create a ticketed event, and you can paste it anywhere to render an add to cart form for that event. You don’t need to use it on the event page itself, although you certainly can.

The second shortcode is for displaying a collection of tickets:

[tickets events='14,29,38' template='<h3>{post_title}: {event_begin format="l, F d"}</h3><p>{post_excerpt}</p>']

This shortcode will render the add to cart forms for the IDs provided, using the template provided. The example above is the default, and is what you’ll see if you don’t use the template attribute. The registration form itself will appear after the templated data. The entire output will be wrapped in a div element with the class mt-event-item.

Quick Start Guide

To start using My Tickets, follow these steps:

  1. Figure out how you want to promote your events. Do you create a new Page for events? Then you’ll want to sell Tickets on Pages. Go to My Tickets > Settings. Scroll to the bottom and select ‘Pages’ from the list of available post types.
  2. Go to My Tickets > Payment Settings. If you intend to collect payment when ticket holders arrive at your event, you can leave the ‘Offline’ payment gateway enabled. You’ll need to collect payments when your guests arrive. If you want to collect payment automatically, you’ll need to enable another gateway and enter your payment information for that gateway. PayPal Standard is available with the free plug-in, or purchase premium gateways.
  3. Enable the “Testing mode” on the same page if you want to run transactions without actually processing payments.
  4. Go to Pages > Add New and add a new page for your event. On that page, check the box labeled “Sell Tickets on this post.”
  5. Fill in the fields for your event. The defaults that are set up from the beginning are set at My Tickets > Ticket Settings. Those defaults are useful if most of your events use the same settings, but you can customize them on every event. Tickets won’t be available for sale unless there’s an event date and time set, a specific number of tickets available, and a price set for at least one type of ticket.
  6. You’ll notice an option for Complimentary tickets. These tickets aren’t available for most users – only users with permissions to manage the box office (administrators, by default) are able to see these.
  7. Go to view your newly saved page. You should see a panel to add tickets to your cart. Add some tickets to your cart.
  8. Follow the link to go view your cart. If you’re logged in as an administrator, you’ll have two options from here: you can either proceed through the purchase process, or you can click through and generate a new payment with the information in that cart. That’s also an option only available to box office managers, which gives you the ability to easily add sales that you take over the phone or in person at your box office facility, if you have one.

When a purchaser makes a purchase, a Payment will be created in the back-end. It’ll be marked as ‘Pending’ until a payment is completed. With offline payments, you’ll always need to mark the payments as completed manually, when you receive payment. With online payments, they should be marked as completed as soon as the payment finishes processing. That’s usually very close to instantaneously, unless a Paypal payment is accepted that’s using an eCheck. In that case, it could take 3-7 days to complete.


My Tickets has been written to be as accessible as I can make it — it uses ARIA live regions to ensure that shopping cart feedback is immediately available to those who need it, uses solid, semantic HTML markup, and considers all the best practices for form labeling.

Accessibility is a priority for me, and is one of my primary focuses in development – but that doesn’t mean that I’ve caught every possible issue! If you find an accessibility issue, please do report it to me like any other issue – it’s a bug, and it needs to be fixed!

Quick Cart

The “Quick Cart” shows the number of tickets currently in a visitor’s shopping cart and the total price of their cart, with a link to check out. By default, it looks like this:

In your cart: 7 tickets | $56.00 | Checkout

Like everything else in My Tickets, the default CSS is very spartan, to allow you to customize easily, without needing to override existing styles. The HTML, however, has many available hooks for you to use for your own design needs.

<div class='mt-quick-cart' aria-live='polite'>In your cart: <span class='mt_qc_tickets'>7</span> tickets
	<span class='divider'>|</span> 
	<span class='mt_currency'>$</span><span class='mt_qc_total'>56.00</span>
	<span class='divider'>|</span> 
	<a href="">Checkout</a>


There are four key sections of My Tickets that are templatable: receipts, tickets, the opt-out form for email notifications, and the ticket verification screen used by ticket-takers. They’re all templatable in the standard WordPress way: take a copy of the file from wp-content/plugins/my-tickets/templates/, place it at the root of your theme directory, and edit it until it does what you want.

By default, the templates enqueue their own custom CSS. This CSS is added using the plugin URL, so if you have copied the template into your theme directory, it won’t be automatically accessing the right URL. In the file, find <?php echo plugins_url( 'css/generic.css', __FILE__ ); ?> and <?php echo plugins_url( 'css/ticket.css', __FILE__ ); ?>. Change those to <?php echo plugin_dir_url( 'my-tickets/css/generic.css', __FILE__ ); ?> and <?php echo plugin_dir_url( 'my-tickets/css/generic.css', __FILE__ ); ?>.

You can use that CSS and extend it, or create your own; there are no limitations – the templates include their own CSS, so you simply edit the template to include something different, if that’s what you want.

All My Tickets specific templating functions are in the file my-tickets/mt-templating.php. All functions prefixed with ‘mt_get_’ will return the data for manipulation in PHP; all functions without ‘get_’ will echo the result.

Script Resources

My Tickets enqueues a small number of useful scripts you can take advantage of in your theme or custom extension to My Tickets. One that’s particular useful if you’re writing a custom payment gateway is jQuery Payments, the jQuery plug-in by Stripe for validating and handling credit card payment information.

Additionally, the AJAX actions used by My Tickets to add, remove, and update the shopping cart have hooks usable to handle custom actions during shopping cart updates. See the filters and actions reference for more assistance with My Tickets’ filters and actions.

Custom CSS

My Tickets provides relatively sparse default styles. These styles are intended to do the minimum necessary to make My Tickets usable, and reasonably attractive as long as the theme doesn’t impose too many changes.

My Tickets is intended to be customized. You can add your own styles through your theme, but it’s also very easy to override all of My Tickets default CSS. If you add a stylesheet called ‘mt-cart.css’ into a directory in your theme called ‘css’, that stylesheet will be used in place of the default My Tickets stylesheet.

Because the CSS used by My Tickets is designed to be overridden, there’s a very good chance that much of the styles will be overridden by various characteristics of your theme. This is intentional, to keep My Tickets light-weight and easy to modify, but does have consequences if you don’t have the knowledge or experience to customize stylesheets.

Customizing CSS is outside what is provided as support for My Tickets, but if you need assistance, you can submit a support request to hire Joe Dolson Accessible Web Design for customization tasks or to point you towards a developer who can help you.

Custom Field API

If you’re selling tickets, it’s not uncommon that you’ll need to gather some form of custom information. Do you need your customers to check a box verifying that they’re over 18? Do you need to get a phone number for each event? Find out which meal a customer would prefer for lunch?

My Tickets supports a custom field API that can add a custom field into the “Add to Cart” form. What it does is largely up to you; but it’s very easy to write a basic extension to collect custom data for an event.

Custom fields are added using the filter ‘mt_custom_fields‘.

In the filter, all you need to do is add an array of data to the custom fields array that passes the label for your custom field, a sanitization callback function, a display callback function, an input type, a set of values to choose from, and a context.

Any of these values can be omitted except for the label.

If you only provide a label, you will create a text input field with no default value. It’ll be sanitized using esc_sql and strip_tags. The display callback will call esc_attr and stripslashes on the value for display. When you create a callback, your callback gets two arguments: the data value itself, and the context it’s shown in. That will either by ‘cart’, for the shopping cart or add to cart context, or ‘payment’, if it’s being shown in the admin.

Supported input types include all the basic inputs, but do not currently include an upload field or other media selection method.

The context for the field defaults to ‘global’, but you can also pass a specific event ID or an array of event IDs. This rule defines where the custom field will show up – with ‘global’, it’ll show up on all add to cart forms. To create custom rules for displaying custom fields, use the ‘mt_apply_custom_field_rules‘ filter.

Example Implementation

add_filter( 'mt_custom_fields', 'create_custom_fields', 10, 1 );
function create_custom_fields( $array ) {
	// Other fields: sanitize callback; input type; input values; display_callback
	$array['test_event_data'] = array( 
		'title'=>"Meal preference", 
		'input_values'=>array( 'Chicken', 'Salad', 'Doughnut' ),
		'context'=> 'global'
	return $array;

/* Display callback formats the saved data. $context is 'payment' or 'cart', depending on whether it appears in an admin payment or the user's shopping cart. */
function display_callback( $data, $context='payment' ) {
	return urldecode( $data );

/* Sanitize callback cleans the data before saving to the DB */
function sanitize_callback( $data ) {
	return esc_sql( $data );

Adding a custom field will also automatically add this data into the Payments reports and will create a template tag so you can use the custom field in your automatic response emails.