Below, you’ll find a detailed guide on how to add the Ticket Tailor Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Ticket Tailor Plugin shortcode not to show or not to work correctly.
Before starting, here is an overview of the Ticket Tailor Plugin and the shortcodes it provides:
"Sell Tickets – Event Ticketing and Event Registration – Ticket Tailor for WordPress is an effective plugin for seamless event ticketing. It simplifies ticket sales and registration, making event management hassle-free."
- [tt-event]
Ticket Tailor [tt-event] Shortcode
The Ticket Tailor shortcode, ‘tt-event’, is used to embed a ticket booking widget into a webpage. It accepts parameters like ‘url’, ‘minimal’, ‘bg_fill’, ‘inherit_ref_from_url_param’, and ‘ref’. This shortcode dynamically generates a script that fetches and displays the widget from the provided ‘url’. The ‘minimal’, ‘bg_fill’, ‘inherit_ref_from_url_param’, and ‘ref’ parameters modify the widget’s appearance and behavior.
Shortcode: [tt-event]
Parameters
Here is a list of all possible tt-event shortcode parameters and attributes:
url
– link to the Ticket Tailor eventminimal
– enables a minimalistic ticket widget designbg_fill
– fills the background of the widgetshow_logo
– determines if the Ticket Tailor logo is showninherit_ref_from_url_param
– pulls reference from the URL parameterref
– sets the reference for the widget
Examples and Usage
Basic example – This example demonstrates the simplest way to use the ‘tt-event’ shortcode, where only the ‘url’ attribute is defined. This will load the Ticket Tailor widget for the specified event URL.
[tt-event url="https://www.tickettailor.com/events/eventname/12345" /]
Advanced examples
1. This example includes the ‘minimal’ attribute set to ‘true’. This will load the Ticket Tailor widget in a minimalistic style.
[tt-event url="https://www.tickettailor.com/events/eventname/12345" minimal="true" /]
2. This example includes the ‘bg_fill’ attribute set to ‘false’. This will load the Ticket Tailor widget without background fill.
[tt-event url="https://www.tickettailor.com/events/eventname/12345" bg_fill="false" /]
3. This example includes multiple attributes. It sets ‘minimal’ to ‘true’, ‘bg_fill’ to ‘false’, and ‘ref’ to ‘my_custom_ref’. This will load the Ticket Tailor widget in a minimalistic style without background fill and with a custom ref value.
[tt-event url="https://www.tickettailor.com/events/eventname/12345" minimal="true" bg_fill="false" ref="my_custom_ref" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [tt-event]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('tt-event', 'tt_event_load');
Shortcode PHP function:
function tt_event_load($atts) {
if(!isset($atts['url'])) return "<p>Error: No URL set for Ticket Tailor widget</p>";
$url = $atts['url'];
$minimal = false;
$bg_fill = true;
$show_logo = true;
$inherit_ref_from_url_param = '';
$ref = 'website_widget';
if(isset($atts['minimal'])) $minimal = $atts['minimal'];
if(isset($atts['bg_fill'])) $bg_fill = $atts['bg_fill'];
if(isset($atts['inherit_ref_from_url_param'])) $inherit_ref_from_url_param = $atts['inherit_ref_from_url_param'];
if(isset($atts['ref'])) $ref = $atts['ref'];
return '
<div class="tt-widget">
<script src="https://cdn.tickettailor.com/js/widgets/min/widget.js"
data-url="'.$url.'"
data-type="inline"
data-inline-minimal="'.$minimal.'"
data-inline-show-logo="'.$show_logo.'"
data-inline-bg-fill="'.$bg_fill.'"
data-inline-inherit-ref-from-url-param="'.$inherit_ref_from_url_param.'"
data-inline-ref="'.$ref.'">
</script>
</div>
';
}
Code file location:
ticket-tailor/ticket-tailor/ticket-tailor-sell-tickets-online.php
Conclusion
Now that you’ve learned how to embed the Ticket Tailor Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.
Leave a Reply