Tickera Shortcodes

Below, you’ll find a detailed guide on how to add the Tickera – WordPress Event Ticketing Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Tickera – WordPress Event Ticketing Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Tickera – WordPress Event Ticketing Plugin and the shortcodes it provides:

Plugin Icon
Tickera – WordPress Event Ticketing

"Tickera – WordPress Event Ticketing is a robust tool designed to simplify ticketing for all your events. With this plugin, manage ticket sales smoothly and efficiently directly on your WordPress site."

★★★★✩ (249) Active Installs: 4000+ Tested with: 6.3.2 PHP Version: 5.6
Included Shortcodes:
  • [tc_cart]
  • [tc_additional_fields]
  • [tc_additional_fields_edd]
  • [tc_process_payment]
  • [tc_ipn]
  • [tc_order_history]
  • [tc_payment]
  • [tc_order_confirmation]
  • [tc_order_details]
  • [ticket]
  • [ticket_price]
  • [tickets_sold]
  • [tickets_left]
  • [event]
  • [event_tickets_sold]
  • [event_tickets_left]
  • [tc_event_date]
  • [tc_event_location]
  • [tc_event_terms]
  • [tc_event_sponsors_logo]
  • [tc_event_logo]

Tickera [tc_cart] Shortcode

The Tickera Event Ticketing System shortcode, ‘tc_cart’, is designed to display the cart contents on a webpage. This shortcode starts a session, locates the ‘shortcode-cart-contents.php’ template, and includes it on the page. If the template is not found in the theme, it defaults to the plugin’s template. The session is then closed and the contents are displayed.

Shortcode: [tc_cart]

Examples and Usage

Basic example – A simple usage of the ‘tc_cart’ shortcode without any attributes. This will display the contents of the cart on the page where the shortcode is placed.

[tc_cart /]

PHP Function Code

In case you have difficulties debugging what causing issues with [tc_cart] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'tc_cart', array( &$this, 'tc_cart_page' ) );

Shortcode PHP function:

function tc_cart_page( $atts ) {

        global $tc;

        ob_start();
        $tc->session->start();

        $theme_file = locate_template( [ 'shortcode-cart-contents.php' ] );

        if ( '' != $theme_file ) {
            include $theme_file;

        } else {
            include $tc->plugin_dir . 'includes/templates/shortcode-cart-contents.php';
        }

        $tc->session->close();
        return wpautop( ob_get_clean(), false );
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Tickera [tc_additional_fields] Shortcode

The Tickera Event Ticketing System shortcode, ‘tc_additional_fields’, initiates a session and includes a template file. It’s used to display additional fields in the cart. It starts a session, locates the template file ‘shortcode-cart-additional-info-fields.php’, and includes it. If the template isn’t found in the theme, it defaults to the plugin’s template. The session then closes, and the output is returned.

Shortcode: [tc_additional_fields]

Examples and Usage

Basic example – A simple usage of the tc_additional_fields shortcode without any parameters.

[tc_additional_fields /]

Advanced examples

Using the tc_additional_fields shortcode with a custom theme file. The theme file should be located in the active theme’s directory and named ‘shortcode-cart-additional-info-fields.php’. If the file is not found in the theme’s directory, the plugin will default to its own template file.

function custom_tc_additional_fields( $atts ) {

    global $tc;

    ob_start();
    $tc->session->start();

    $theme_file = locate_template( [ 'custom-shortcode-cart-additional-info-fields.php' ] );

    if ( '' != $theme_file ) {
        include $theme_file;

    } else {
        include $tc->plugin_dir . 'includes/templates/shortcode-cart-additional-info-fields.php';
    }

    $tc->session->close();
    return wpautop( ob_get_clean(), false );
}
add_shortcode( 'custom_tc_additional_fields', 'custom_tc_additional_fields' );

Then use the newly created shortcode in your content.

[custom_tc_additional_fields /]

Note: The advanced example requires knowledge of PHP and WordPress theme development. Always ensure to test your code in a staging environment before applying it to a live site.

PHP Function Code

In case you have difficulties debugging what causing issues with [tc_additional_fields] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'tc_additional_fields', array( &$this, 'tc_additional_fields' ) );

Shortcode PHP function:

function tc_additional_fields( $atts ) {

        global $tc;

        ob_start();
        $tc->session->start();

        $theme_file = locate_template( [ 'shortcode-cart-additional-info-fields.php' ] );

        if ( '' != $theme_file ) {
            include $theme_file;

        } else {
            include $tc->plugin_dir . 'includes/templates/shortcode-cart-additional-info-fields.php';
        }

        $tc->session->close();
        return wpautop( ob_get_clean(), false );
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Tickera [tc_additional_fields_edd] Shortcode

The Tickera shortcode, ‘tc_additional_fields_edd’, is designed to enhance the functionality of your event ticketing system. This shortcode initiates a session, then includes additional information fields from the EDD template into the cart. It then closes the session and returns the output. This allows for more detailed data collection from customers during the checkout process.

Shortcode: [tc_additional_fields_edd]

Examples and Usage

Basic example – The shortcode ‘tc_additional_fields_edd’ is used to include additional fields in the Easy Digital Downloads plugin. The basic usage of this shortcode doesn’t require any parameters.

[tc_additional_fields_edd /]

Advanced examples

The ‘tc_additional_fields_edd’ shortcode doesn’t have any defined parameters in the provided function. However, you can pass custom parameters and use them in the ‘shortcode-cart-additional-info-fields-edd.php’ file. Here’s an example of how you can do it:

[tc_additional_fields_edd param1="value1" param2="value2" /]

In this example, ‘param1’ and ‘param2’ are the custom parameters. You can access these parameters in the ‘shortcode-cart-additional-info-fields-edd.php’ file using the $atts array, like this:


$param1 = $atts['param1'];
$param2 = $atts['param2'];

Remember that the actual usage of these parameters will depend on the code in the ‘shortcode-cart-additional-info-fields-edd.php’ file.

PHP Function Code

In case you have difficulties debugging what causing issues with [tc_additional_fields_edd] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'tc_additional_fields_edd', array( &$this, 'tc_additional_fields_edd' ) );

Shortcode PHP function:

function tc_additional_fields_edd( $atts ) {
        global $tc;
        ob_start();
        $tc->session->start();

        include $tc->plugin_dir . 'includes/templates/shortcode-cart-additional-info-fields-edd.php';

        $tc->session->close();
        return wpautop( ob_get_clean(), false );
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Tickera [tc_process_payment] Shortcode

The Tickera Event Ticketing System shortcode, ‘tc_process_payment’, initiates the payment process for tickets. This shortcode starts a session, includes the ‘page-process-payment.php’ template, then closes the session. It returns the processed output, ensuring a smooth payment process.

Shortcode: [tc_process_payment]

Examples and Usage

Basic example – A simple usage of the ‘tc_process_payment’ shortcode without any parameters. This will trigger the payment process defined in the ‘tc_process_payment_page’ function.

[tc_process_payment /]

Advanced examples

Using the shortcode with additional parameters. In this case, we are passing a custom session start and close message. The ‘start_message’ and ‘close_message’ parameters will be used to customize the session messages during the payment process. Note that these parameters will only work if they are defined and handled in the ‘tc_process_payment_page’ function.

[tc_process_payment start_message="Starting payment process..." close_message="Payment process completed." /]

Another advanced example could be passing a custom template for the payment process. Here, ‘custom_template’ parameter is used to specify a different template file located in the plugin’s ‘includes/templates/’ directory. Again, this will only work if the ‘tc_process_payment_page’ function is modified to handle this parameter.

[tc_process_payment custom_template="page-custom-payment.php" /]

Please note that in order to use these advanced examples, you would need to modify the ‘tc_process_payment_page’ function to handle these parameters. Always ensure to test your changes thoroughly to prevent any issues on your website.

PHP Function Code

In case you have difficulties debugging what causing issues with [tc_process_payment] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'tc_process_payment', array( &$this, 'tc_process_payment_page' ) );

Shortcode PHP function:

function tc_process_payment_page( $atts ) {
        global $tc;
        ob_start();
        $tc->session->start();

        include( $tc->plugin_dir . 'includes/templates/page-process-payment.php' );

        $tc->session->close();
        return wpautop( ob_get_clean(), true );
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Tickera [tc_ipn] Shortcode

The Tickera Event Ticketing System shortcode is a tool that handles Instant Payment Notifications (IPNs). This shortcode starts a session and includes the page-ipn.php template from the plugin’s directory. It then closes the session and returns the output. This allows the plugin to process payment notifications and update ticket status accordingly.

Shortcode: [tc_ipn]

Examples and Usage

Basic Example – The given shortcode is used to include the IPN page in your content. It doesn’t require any parameters to work, hence making it simple to implement.

[tc_ipn /]

Advanced Examples

In this advanced example, we are using a hypothetical scenario where the ‘tc_ipn_page’ function has been modified to accept parameters. Please note that this is not the actual function, it’s only for demonstration purposes.

Let’s say the function has been modified to accept two parameters: ‘template’ and ‘session’. The ‘template’ parameter allows you to specify the template to use for the IPN page, and the ‘session’ parameter allows you to specify whether to start a session or not.

[tc_ipn template="custom-template" session="no" /]

In the above example, we’re specifying ‘custom-template’ as the template to use for the IPN page, and we’re also specifying that a session should not be started.

Again, this is a hypothetical example and the actual ‘tc_ipn_page’ function does not accept any parameters. If you need to modify the function to accept parameters, you’ll need to do so in the plugin’s PHP code.

PHP Function Code

In case you have difficulties debugging what causing issues with [tc_ipn] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'tc_ipn', array( &$this, 'tc_ipn_page' ) );

Shortcode PHP function:

function tc_ipn_page( $atts ) {
        global $tc;
        ob_start();
        $tc->session->start();

        include( $tc->plugin_dir . 'includes/templates/page-ipn.php' );

        $tc->session->close();
        return wpautop( ob_get_clean(), true );
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Tickera [tc_order_history] Shortcode

The Tickera Event Ticketing System shortcode, ‘tc_order_history’, is designed to display the order history of a user. This shortcode starts a new session, includes the ‘shortcode-order-history-contents.php’ file from the plugin’s directory, and then closes the session. The output is then cleaned and returned. The shortcode is useful for providing users with a history of their orders.

Shortcode: [tc_order_history]

Examples and Usage

Basic example – The basic usage of the ‘tc_order_history’ shortcode without any additional parameters or attributes.

[tc_order_history /]

PHP Function Code

In case you have difficulties debugging what causing issues with [tc_order_history] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'tc_order_history', array( &$this, 'tc_order_history_page' ) );

Shortcode PHP function:

function tc_order_history_page( $atts ) {
        global $tc;
        ob_start();
        $tc->session->start();

        include( $tc->plugin_dir . 'includes/templates/shortcode-order-history-contents.php' );

        $tc->session->close();
        return wpautop( ob_get_clean(), true );
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Tickera [tc_payment] Shortcode

The Tickera Event Ticketing System shortcode, ‘tc_payment’, is designed to manage payments. This shortcode initiates a session, includes the ‘page-payment.php’ template from the plugin directory, and then closes the session. It’s used to display the payment page to users. It returns the output after applying ‘wpautop’ function for formatting.

Shortcode: [tc_payment]

Examples and Usage

Basic example – In the simplest form, the ‘tc_payment’ shortcode can be used without any additional parameters. This will display the default payment page as defined in the Tickera plugin’s settings.

[tc_payment /]

Advanced examples

In more advanced use cases, you might want to customize the behavior of the ‘tc_payment’ shortcode by passing additional parameters. While the provided PHP function does not explicitly define any parameters, you might be able to influence its behavior by setting global variables or modifying the included template file.

For example, you could define a global variable before the shortcode, which will then be used in the included template file:


<?php $GLOBALS['my_custom_var'] = 'some value'; ?>
[tc_payment /]

Note that this requires modifications to the ‘page-payment.php’ template file, which should be done by a developer with knowledge of PHP and WordPress.

Alternatively, you could create a custom template file and include it instead of the default ‘page-payment.php’. This would allow you to completely customize the output of the shortcode:


<?php
function my_custom_tc_payment_page( $atts ) {
    global $tc;
    ob_start();
    $tc->session->start();

    include( get_stylesheet_directory() . '/my-custom-page-payment.php' );

    $tc->session->close();
    return wpautop( ob_get_clean(), true );
}
add_shortcode( 'my_custom_tc_payment', 'my_custom_tc_payment_page' );
?>

With this new shortcode, you can use [my_custom_tc_payment /] to display your custom payment page.

PHP Function Code

In case you have difficulties debugging what causing issues with [tc_payment] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'tc_payment', array( &$this, 'tc_payment_page' ) );

Shortcode PHP function:

function tc_payment_page( $atts ) {
        global $tc;
        ob_start();
        $tc->session->start();

        include( $tc->plugin_dir . 'includes/templates/page-payment.php' );

        $tc->session->close();
        return wpautop( ob_get_clean(), true );
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Tickera [tc_order_confirmation] Shortcode

The Tickera Event Ticketing System shortcode, ‘tc_order_confirmation’, initiates a session and includes a confirmation page template. It then closes the session and returns the output.

Shortcode: [tc_order_confirmation]

Examples and Usage

Basic example – The following shortcode is a basic usage of the tc_order_confirmation_page function. It does not require any additional parameters to work correctly.

[tc_order_confirmation /]

Advanced examples

Given the nature of the tc_order_confirmation_page function, it doesn’t accept parameters. However, if you modify the function to accept parameters, you can use it in a more advanced way. Below is an example of how you might modify the function to accept a ‘message’ parameter:

function tc_order_confirmation_page( $atts ) {
    global $tc;
    ob_start();
    $tc->session->start();

    // Extract the attributes
    extract(shortcode_atts(array(
        'message' => 'Thank you for your order!'
    ), $atts));

    // Use the 'message' attribute
    echo '

' . $message . '

'; include( $tc->plugin_dir . 'includes/templates/page-confirmation.php' ); $tc->session->close(); return wpautop( ob_get_clean(), true ); }

Now, you can use the ‘message’ parameter in your shortcode:

[tc_order_confirmation message="Your order has been processed successfully!" /]

This will display the order confirmation page with a custom message at the top.

PHP Function Code

In case you have difficulties debugging what causing issues with [tc_order_confirmation] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'tc_order_confirmation', array( &$this, 'tc_order_confirmation_page' ) );

Shortcode PHP function:

function tc_order_confirmation_page( $atts ) {
        global $tc;
        ob_start();
        $tc->session->start();

        include( $tc->plugin_dir . 'includes/templates/page-confirmation.php' );

        $tc->session->close();
        return wpautop( ob_get_clean(), true );
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Tickera [tc_order_details] Shortcode

The Tickera Event Ticketing System shortcode, ‘tc_order_details’, displays the details of a specific order. This shortcode initiates a session, includes the page-order.php template from the plugin’s directory, and then closes the session. The output is cleaned and returned, allowing the order details to be displayed on the frontend.

Shortcode: [tc_order_details]

Examples and Usage

Basic example – Provides a simple usage of the ‘tc_order_details’ shortcode without any additional attributes.

[tc_order_details /]

PHP Function Code

In case you have difficulties debugging what causing issues with [tc_order_details] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'tc_order_details', array( &$this, 'tc_order_details_page' ) );

Shortcode PHP function:

function tc_order_details_page( $atts ) {
        global $tc, $wp;
        ob_start();
        $tc->session->start();

        include( $tc->plugin_dir . 'includes/templates/page-order.php' );

        $tc->session->close();
        return wpautop( ob_get_clean(), true );
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Tickera [ticket] Shortcode

The Tickera Event Ticketing System shortcode is used to add a ticket cart button on a webpage. It offers various customization options like showing price, position of price, and sold-out messages. The shortcode checks if sales are available for a particular ticket and if the event is published. It also verifies if the ticket limit has been exceeded or if user login is required.

Shortcode: [ticket]

Parameters

Here is a list of all possible ticket shortcode parameters and attributes:

  • id – Unique identifier for the ticket.
  • title – Text displayed on the button.
  • show_price – Determines if the ticket price is shown.
  • price_position – Position of the price, ‘before’ or ‘after’ the title.
  • price_wrapper – HTML tag to wrap the price.
  • price_wrapper_class – CSS class for the price wrapper.
  • soldout_message – Message displayed when tickets are sold out.
  • type – Defines the type of button, ‘cart’ for adding to cart.
  • open_method – Method of opening, ‘regular’ for normal page load.
  • quantity – Determines if quantity selector is shown.
  • wrapper – HTML tag to wrap the entire shortcode output.

Examples and Usage

Basic example – A simple usage of the shortcode to display the ‘Add to Cart’ button for a specific ticket. The ID of the ticket is required.

[ticket id=1 /]

Advanced examples

Displaying the ‘Add to Cart’ button with a custom title. The title of the button is set to ‘Purchase Ticket’ instead of the default ‘Add to Cart’.

[ticket id=1 title='Purchase Ticket' /]

Displaying the ‘Add to Cart’ button with the ticket price. The ‘show_price’ parameter is set to true to display the price. The ‘price_position’ parameter is set to ‘before’ to display the price before the title.

[ticket id=1 show_price=true price_position='before' /]

Displaying the ‘Add to Cart’ button with a custom sold-out message. The ‘soldout_message’ parameter is used to display a custom message when the tickets are sold out.

[ticket id=1 soldout_message='Sorry, tickets are no longer available for this event.' /]

Displaying the ‘Add to Cart’ button with a quantity selector. The ‘quantity’ parameter is set to true to display a quantity selector next to the button.

[ticket id=1 quantity=true /]

PHP Function Code

In case you have difficulties debugging what causing issues with [ticket] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'ticket', array( &$this, 'ticket_cart_button' ) );

Shortcode PHP function:

function ticket_cart_button( $atts ) {

        global $tc;
        $tc_general_settings = get_option( 'tc_general_setting', false );

        extract( shortcode_atts(
                array(
                    'id' => false,
                    'title' => __( 'Add to Cart', 'tc' ),
                    'show_price' => false,
                    'price_position' => 'after',
                    'price_wrapper' => 'span',
                    'price_wrapper_class' => 'price',
                    'soldout_message' => __( 'Tickets are sold out.', 'tc' ),
                    'type' => 'cart',
                    'open_method' => 'regular',
                    'quantity' => false,
                    'wrapper' => ''
                ), $atts
            )
        );

        $id = (int) $id;
        $show_price = (bool) $show_price;
        $quantity = (bool) $quantity;

        $ticket_type = new TC_Ticket( $id, 'publish' );
        $event_id = get_post_meta( $id, 'event_name', true );

        if ( $id && TC_Ticket::is_sales_available( $id )
            && isset( $ticket_type->details->ID ) && 'publish' == get_post_status( $event_id ) ) {

            // Check if ticket still exists
            $with_price_content = ( $show_price ) ? ' <span class="' . esc_attr( $price_wrapper_class ) . '">' . tc_esc_html( do_shortcode( '[ticket_price id="' . (int) $id . '"]' ) ) . '</span> ' : '';

            if ( is_array( $tc->get_cart_cookie() ) && array_key_exists( $id, $tc->get_cart_cookie() ) ) {
                $button = sprintf( '<' . sanitize_text_field( $price_wrapper ) . ' class="tc_in_cart">%s <a href="%s">%s</a></' . sanitize_text_field( $price_wrapper ) . '>', apply_filters( 'tc_ticket_added_to_message', __( 'Ticket added to', 'tc' ) ), esc_url( $tc->get_cart_slug( true ) ), apply_filters( 'tc_ticket_added_to_cart_message', __( 'Cart', 'tc' ) ) );

            } else {

                if ( $ticket_type->is_sold_ticket_exceeded_limit_level() === false ) {

                    if ( isset( $tc_general_settings[ 'force_login' ] ) && 'yes' == $tc_general_settings[ 'force_login' ] && ! is_user_logged_in() ) {
                        $button = '<form class="cart_form">' . ( 'before' == $price_position ? $with_price_content : '' ) . '<a href="' . esc_url( apply_filters( 'tc_force_login_url', wp_login_url( get_permalink() ), get_permalink() ) ) . '" class="add_to_cart_force_login" id="ticket_' . (int) $id . '"><span class="title">' . esc_html( $title ) . '</span></a>' . ( 'after' == $price_position ? $with_price_content : '' ) . '<input type="hidden" name="ticket_id" class="ticket_id" value="' . $id . '"/>' . '</form>';

                    } else {

                        $button = '<form class="cart_form">' . ( true == $quantity ? tc_quantity_selector( $id, true, false ) : '' ) . ( ( 'before' == $price_position ) ? $with_price_content : '' ) . '<a href="#" class="add_to_cart" data-button-type="' . esc_attr( $type ) . '" data-open-method="' . esc_attr( $open_method ) . '" id="ticket_' . esc_attr( $id ) . '"><span class="title">' . esc_html( $title ) . '</span></a>' . ( ( 'after' == $price_position ) ? $with_price_content : '' ) . '<input type="hidden" name="ticket_id" class="ticket_id" value="' . esc_attr( $id ) . '"/>' . '</form>';
                    }

                } else {
                    $button = '<span class="tc_tickets_sold">' . sanitize_text_field( $soldout_message ) . '</span>';
                }
            }

            if ( $id && 'tc_tickets' == get_post_type( $id ) ) {
                return $button;

            } else {
                return __( 'Unknown ticket ID', 'tc' );
            }

        } else {
            return '';
        }
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Tickera [ticket_price] Shortcode

The Tickera Event Ticketing System shortcode ‘ticket_price’ displays the price of a specific event ticket. It extracts the ticket’s ID and retrieves its price.

Shortcode: [ticket_price]

Parameters

Here is a list of all possible ticket_price shortcode parameters and attributes:

  • id – Specifies the unique identifier of the ticket

Examples and Usage

Basic Example – A simple usage of the ‘ticket_price’ shortcode to display the price of a ticket with a specific ID.

[ticket_price id=1 /]

Advanced Example – In this example, the ‘ticket_price’ shortcode is used within a paragraph to display the price of a ticket with a specific ID. This can be useful in instances where you want to include the ticket price within a larger block of text.

<p>The price of the ticket is: [ticket_price id=1 /]</p>

Please note that in these examples, ‘1’ is the ID of the ticket, and this will need to be replaced with the actual ID of the ticket you wish to display the price for.

PHP Function Code

In case you have difficulties debugging what causing issues with [ticket_price] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'ticket_price', array( &$this, 'ticket_price' ) );

Shortcode PHP function:

function ticket_price( $atts ) {
        global $tc;
        extract( shortcode_atts( array(
            'id' => ''
        ), $atts ) );

        $ticket = new TC_Ticket( (int) $id, 'publish' );
        return tc_sanitize_string( apply_filters( 'tc_cart_currency_and_format', tc_get_ticket_price( $ticket->details->ID ) ) );
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Tickera [tickets_sold] Shortcode

The Tickera Event Ticketing System shortcode, ‘tickets_sold’, is designed to display the number of tickets sold for a specific ticket type. By using the ‘ticket_type_id’ parameter, you can specify the ticket type. The function ‘tc_get_tickets_count_sold’ is then called to return the count of sold tickets for that ticket type. This shortcode provides an efficient way to track ticket sales.

Shortcode: [tickets_sold]

Parameters

Here is a list of all possible tickets_sold shortcode parameters and attributes:

  • ticket_type_id – Identifier for the specific type of ticket

Examples and Usage

Basic example – Displays the number of tickets sold for a specific ticket type.

[tickets_sold ticket_type_id=1 /]

For advanced usage, you can use the shortcode to display the number of tickets sold for multiple ticket types by specifying their IDs. This can be useful if you have different ticket types for a single event and want to display the sales for each of them.

Advanced examples

[tickets_sold ticket_type_id=1 /]
[tickets_sold ticket_type_id=2 /]
[tickets_sold ticket_type_id=3 /]

Remember, each shortcode should be placed in its own paragraph or block for proper formatting. The ‘ticket_type_id’ parameter should be replaced with the actual ID of the ticket type you want to display the sales for.

PHP Function Code

In case you have difficulties debugging what causing issues with [tickets_sold] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'tickets_sold', array( &$this, 'tickets_sold' ) );

Shortcode PHP function:

function tickets_sold( $atts ) {
        extract( shortcode_atts( array(
            'ticket_type_id' => ''
        ), $atts ) );
        return tc_get_tickets_count_sold( $ticket_type_id );
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Tickera [tickets_left] Shortcode

The Tickera Event Ticketing System shortcode, ‘tickets_left’, is designed to display the number of tickets left for a specific event. The shortcode takes ‘ticket_type_id’ as an attribute, which refers to the ID of the specific ticket type. The function ‘tc_get_tickets_count_left’ then returns the count of remaining tickets for that event.

Shortcode: [tickets_left]

Parameters

Here is a list of all possible tickets_left shortcode parameters and attributes:

  • ticket_type_id – Identifier for the specific type of ticket

Examples and Usage

Basic example – Utilize the shortcode to display the number of tickets left for a specific ticket type, identified by its ID.

[tickets_left ticket_type_id=3 /]

Advanced examples

Use the shortcode without specifying an ID, the function will return the number of tickets left for all ticket types.

[tickets_left /]

Specify multiple ticket types by separating their IDs with commas. The function will return the total number of tickets left for the specified ticket types.

[tickets_left ticket_type_id=3,5,7 /]

PHP Function Code

In case you have difficulties debugging what causing issues with [tickets_left] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'tickets_left', array( &$this, 'tickets_left' ) );

Shortcode PHP function:

function tickets_left( $atts ) {
        extract( shortcode_atts( array(
            'ticket_type_id' => ''
        ), $atts ) );
        return tc_get_tickets_count_left( $ticket_type_id );
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Tickera [event] Shortcode

The Tickera Event shortcode allows the display of event details on a WordPress website. It fetches event data like ticket types, prices, and availability. This shortcode can display data in a table or dropdown format. It also provides customization options, like showing the event title, price, and quantity. The shortcode also handles sold-out cases, displaying a sold-out message when necessary.

Shortcode: [event]

Parameters

Here is a list of all possible event shortcode parameters and attributes:

  • id – Unique identifier of the event.
  • event_table_class – CSS class of the event table.
  • display_type – Defines how the tickets are displayed either as ‘table’ or ‘dropdown’.
  • show_event_title – Boolean to decide if the event title should be displayed.
  • ticket_type_title – The title for the ‘Ticket Type’ column.
  • show_price – Boolean to decide if the ticket price should be displayed.
  • price_title – The title for the ‘Price’ column.
  • cart_title – The title for the ‘Cart’ column.
  • soldout_message – The message to display when tickets are sold out.
  • quantity_title – The title for the ‘Quantity’ column.
  • quantity – Boolean to decide if the quantity field should be displayed.
  • type – Defines the type of the ticket, default is ‘cart’.
  • open_method – Defines how the ticket window should open, default is ‘regular’.
  • title – The title for the ‘Add to Cart’ button.
  • wrapper – Additional HTML wrapper for the shortcode output.

Examples and Usage

Basic example – Display event tickets in a table format with a specified event id.

[event id=1 /]

Advanced examples

Display event tickets in a table format with a specified event id, custom table class, and with quantity column.

[event id=1 event_table_class="my_custom_class" quantity=true /]

Display event tickets in a dropdown format with a specified event id, and show event title and price.

[event id=1 display_type="dropdown" show_event_title=true show_price=true /]

Display event tickets in a dropdown format with a specified event id, custom ‘add to cart’ title, custom sold-out message, and specify the open method.

[event id=1 display_type="dropdown" title="Add to Basket" soldout_message="All tickets are sold out." open_method="lightbox" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [event] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'event', array( &$this, 'event' ) );

Shortcode PHP function:

function event( $atts ) {

        ob_start();
        global $tc, $post;

        extract( shortcode_atts( array(
            'id' => false,
            'event_table_class' => 'event_tickets tickera',
            'display_type' => 'table',
            'show_event_title' => false,
            'ticket_type_title' => __( 'Ticket Type', 'tc' ),
            'show_price' => false,
            'price_title' => __( 'Price', 'tc' ),
            'cart_title' => __( 'Cart', 'tc' ),
            'soldout_message' => __( 'Tickets are sold out.', 'tc' ),
            'quantity_title' => __( 'Qty.', 'tc' ),
            'quantity' => false,
            'type' => 'cart',
            'open_method' => 'regular',
            'title' => __( 'Add to Cart', 'tc' ),
            'wrapper' => '' ), $atts ) );

        $id = ( empty( $id ) || ! $id ) ? (int) $post->ID : (int) $id;

        $event = new TC_Event( $id );
        $event_tickets = $event->get_event_ticket_types( 'publish', false, true, false );

        if ( count( $event_tickets ) > 0 ) {

            if ( $event->details->post_status == 'publish' ) : ?>
                <div class="tickera">
                    <?php if ( 'table' == $display_type ) : ?>
                        <div class="tc-event-table-wrap">
                            <table class="<?php echo esc_attr( $event_table_class ); ?>">
                                <tr>
                                    <?php do_action( 'tc_event_col_title_before_ticket_title' ); ?>
                                    <th><?php echo esc_html( $ticket_type_title ); ?></th>
                                    <?php do_action( 'tc_event_col_title_before_ticket_price' ); ?>
                                    <th><?php echo esc_html( $price_title ); ?></th>
                                    <?php if ( $quantity ) { ?>
                                        <?php do_action( 'tc_event_col_title_before_quantity' ); ?>
                                        <th><?php echo esc_html( $quantity_title ); ?></th>
                                    <?php } ?>
                                    <?php do_action( 'tc_event_col_title_before_cart_title' ); ?>
                                    <th><?php echo esc_html( $cart_title ); ?></th>
                                </tr>
                                <?php
                                foreach ( $event_tickets as $event_ticket_id ) {
                                    $event_ticket = new TC_Ticket( (int) $event_ticket_id );
                                    if ( TC_Ticket::is_sales_available( (int) $event_ticket_id ) ) : ?>
                                        <tr>
                                            <?php do_action( 'tc_event_col_value_before_ticket_type', (int) $event_ticket_id ); ?>
                                            <td data-column="<?php esc_attr_e( 'Ticket Type', 'tc' ); ?>"><?php echo tc_esc_html( apply_filters( 'tc_tickets_table_title', $event_ticket->details->post_title, $event_ticket_id ) ); ?></td>
                                            <?php do_action( 'tc_event_col_value_before_ticket_price', (int) $event_ticket_id ); ?>
                                            <td data-column="<?php esc_attr_e( 'Price', 'tc' ); ?>"><?php echo tc_esc_html( do_shortcode( '[ticket_price id="' . (int) $event_ticket->details->ID . '"]' ) ); ?></td>
                                            <?php if ( $quantity ) { ?>
                                                <?php do_action( 'tc_event_col_value_before_quantity', (int) $event_ticket_id ); ?>
                                                <td data-column="<?php esc_attr_e( 'Quantity', 'tc' ); ?>"><?php tc_esc_html( tc_quantity_selector( (int) $event_ticket->details->ID ) ); ?></td>
                                            <?php } ?>
                                            <?php do_action( 'tc_event_col_value_before_cart_title', (int) $event_ticket_id ); ?>
                                            <td data-column="<?php esc_attr_e( 'Cart', 'tc' ); ?>"><?php echo tc_esc_html( do_shortcode( '[ticket id="' . (int) $event_ticket->details->ID . '" type="' . sanitize_text_field( $type ) . '" title="' . sanitize_text_field( $title ) . '" soldout_message="' . sanitize_text_field( $soldout_message ) . '" open_method="' . sanitize_text_field( $open_method ) . '"]' ) ); ?></td>
                                        </tr><?php
                                    endif;
                                }
                                ?>
                            </table>
                        </div><!-- .tc-event-table-wrap -->
                    <?php else :
                        $sales_available = [];
                        ?>
                        <div class="tc-event-dropdown-wrap">
                            <?php if ( $show_event_title ) : ?>
                                <h3><?php _e( $event->details->post_title, 'tc' ); ?></h3>
                            <?php endif; ?>
                            <div class="inner-wrap">
                                <select class="ticket-type-id">
                                    <?php foreach ( $event_tickets as $event_ticket_id ) {
                                        $event_ticket = new TC_Ticket( (int) $event_ticket_id );
                                        if ( TC_Ticket::is_sales_available( (int) $event_ticket_id ) ) :
                                            $sales_available[] = (int) $event_ticket_id;
                                            ?>
                                            <option value="<?php echo (int) $event_ticket_id; ?>"><?php echo tc_esc_html( $event_ticket->details->post_title ) . ( ( $show_price ) ? ' - ' . tc_esc_html( do_shortcode( '[ticket_price id="' . (int) $event_ticket->details->ID . '"]' ) ) : '' ); ?></option>
                                        <?php endif;
                                    } ?>
                                </select>
                                <div class="actions">
                                    <?php foreach ( $event_tickets as $event_ticket_id ) {
                                        if ( in_array( $event_ticket_id, $sales_available ) ) {
                                            echo '<div class="add-to-cart" id="ticket-type-' . (int) $event_ticket_id .'">' . tc_esc_html( do_shortcode( '[ticket id="' . $event_ticket_id . '" type="' . sanitize_text_field( $type ) . '" title="' . sanitize_text_field( $title ) . '" soldout_message="' . sanitize_text_field( $soldout_message ) . '" open_method="' . sanitize_text_field( $open_method ) . '" quantity="' . $quantity . '"]' ) ) . '</div>';
                                        }
                                    } ?>
                                </div>
                            </div>
                        </div>
                    <?php endif; ?>
                </div><!-- tickera -->
                <?php
                return ob_get_clean();
            endif;
        }
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Tickera [event_tickets_sold] Shortcode

The Tickera Event Ticketing System shortcode, ‘event_tickets_sold’, is designed to retrieve and display the number of tickets sold for a specific event. It works by accepting an ‘event_id’ as a parameter. If no ‘event_id’ is provided, it defaults to the ID of the current post. The function ‘tc_get_event_tickets_count_sold’ is then called to return the ticket count.

Shortcode: [event_tickets_sold]

Parameters

Here is a list of all possible event_tickets_sold shortcode parameters and attributes:

  • event_id – The unique identifier of the specific event

Examples and Usage

Basic Example – The following example demonstrates the basic usage of the ‘event_tickets_sold’ shortcode. It doesn’t include any parameters and will return the number of tickets sold for the current event by default.

[event_tickets_sold]

Advanced Examples

Specifying an event ID – In this example, we are specifying the ‘event_id’ parameter. This will return the number of tickets sold for the event with the ID provided.

[event_tickets_sold event_id=2]

Using the shortcode within a PHP function – In this advanced example, we are using the shortcode within a PHP function by using the ‘do_shortcode’ function. This allows us to use the shortcode within our theme files. We are specifying the ‘event_id’ parameter to get the number of tickets sold for the event with the ID provided.


<?php echo do_shortcode('[event_tickets_sold event_id=3]'); ?>

PHP Function Code

In case you have difficulties debugging what causing issues with [event_tickets_sold] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'event_tickets_sold', array( &$this, 'event_tickets_sold' ) );

Shortcode PHP function:

function event_tickets_sold( $atts ) {
        global $post;
        extract( shortcode_atts( array(
            'event_id' => ''
        ), $atts ) );

        if ( empty( $event_id ) ) {
            $event_id = $post->ID;
        }
        return tc_get_event_tickets_count_sold( $event_id );
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Tickera [event_tickets_left] Shortcode

The Tickera Event Ticketing System shortcode, ‘event_tickets_left’, is used to display the remaining tickets for an event. This shortcode, when placed within a post or page, fetches the ID of the event and returns the count of tickets left for that event. If no event ID is specified, it defaults to the ID of the current post.

Shortcode: [event_tickets_left]

Parameters

Here is a list of all possible event_tickets_left shortcode parameters and attributes:

  • event_id – The specific identifier of the event

Examples and Usage

Basic example – The basic usage of the shortcode is to display the number of tickets left for a specific event. The event is identified by its ID.

[event_tickets_left event_id=3 /]

Advanced examples

If you want to use the shortcode within a loop and display the number of tickets left for each post (assuming they are events), you can omit the event_id attribute. The shortcode will automatically use the ID of the current post.

[event_tickets_left /]

You can also use the shortcode in conjunction with other shortcodes or functions. For example, you might want to display a custom message when there are no tickets left for an event. You could achieve this by combining the event_tickets_left shortcode with an if statement and the echo function.

<?php
if (do_shortcode('[event_tickets_left event_id=3 /]') == 0) {
    echo "Sorry, there are no tickets left for this event.";
}
?>

Please note that the above PHP code should be placed in a PHP file or used within a PHP block if you are using a page builder that supports it.

PHP Function Code

In case you have difficulties debugging what causing issues with [event_tickets_left] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'event_tickets_left', array( &$this, 'event_tickets_left' ) );

Shortcode PHP function:

function event_tickets_left( $atts ) {
        global $post;
        extract( shortcode_atts( array(
            'event_id' => ''
        ), $atts ) );

        if ( empty( $event_id ) ) {
            $event_id = $post->ID;
        }
        return tc_get_event_tickets_count_left( $event_id );
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Tickera [tc_event_date] Shortcode

The Tickera Event Ticketing System shortcode, ‘tc_event_date’, fetches and displays the date of a specific event. This shortcode works by extracting the ‘event_id’ or ‘id’ from the attributes. If none are provided, it defaults to the current post ID. It then creates a new instance of TC_Event with the determined ID and returns the event date.

Shortcode: [tc_event_date]

Parameters

Here is a list of all possible tc_event_date shortcode parameters and attributes:

  • event_id – It’s the specific event’s unique identifier.
  • id – Alternative unique identifier for the event.

Examples and Usage

Basic example – Displaying the date of a specific event using its unique event ID.

[tc_event_date event_id=3 /]

Advanced examples

Displaying the date of the event using the post ID if the event ID is not specified.

[tc_event_date id=5 /]

Displaying the date of the event by prioritizing the event ID. If the event ID is not found, it will use the post ID.

[tc_event_date event_id=3 id=5 /]

Note that in the advanced examples, the shortcode will first try to use the ‘event_id’ to fetch the event date. If ‘event_id’ is not specified or the event with such ID does not exist, it will then use the ‘id’ (post ID) to get the event date. If neither ‘event_id’ nor ‘id’ is specified, it will default to the ID of the current post.

PHP Function Code

In case you have difficulties debugging what causing issues with [tc_event_date] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'tc_event_date', array( &$this, 'event_date' ) );

Shortcode PHP function:

function event_date( $atts ) {
        global $post;

        extract( shortcode_atts( array(
            'event_id' => '',
            'id' => '',
        ), $atts ) );

        if ( empty( $id ) && empty( $event_id ) ) {
            $id = $post->ID;
        }

        if ( ! empty( $event_id ) ) {
            $id = $event_id;
        } elseif ( ! empty( $id ) ) {
            $id = $id;
        }

        $event = new TC_Event( $id );


        return $event->get_event_date();
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Tickera [tc_event_location] Shortcode

The Tickera Event Ticketing System shortcode is a powerful tool that displays the location of an event. The shortcode works by pulling the event location from the event’s details in the database. If no ID is provided, it defaults to the ID of the current post. This makes it a versatile tool for displaying event locations across your WordPress site.

Shortcode: [tc_event_location]

Parameters

Here is a list of all possible tc_event_location shortcode parameters and attributes:

  • id – The unique identifier of the specific event

Examples and Usage

Basic example – The shortcode is used to display the location of an event by referencing its ID.

[tc_event_location id=3 /]

Advanced examples

Using the shortcode without specifying an ID. In this case, the location of the current event in the loop will be displayed. This is useful when you are displaying multiple events on a page and want to show the location for each one without having to specify the ID for each one.

[tc_event_location /]

Using the shortcode within a PHP code block. This is useful when you are customizing a theme or plugin and want to embed the event location directly in your PHP code.

<?php echo do_shortcode('[tc_event_location id=3 /]'); ?>

PHP Function Code

In case you have difficulties debugging what causing issues with [tc_event_location] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'tc_event_location', array( &$this, 'event_location' ) );

Shortcode PHP function:

function event_location( $atts ) {
        global $post;
        extract( shortcode_atts( array(
            'id' => ''
        ), $atts ) );

        if ( empty( $id ) ) {
            $id = $post->ID;
        }

        $event = new TC_Event( $id );

        return $event->details->event_location;
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Tickera [tc_event_terms] Shortcode

The Tickera Event Ticketing System shortcode ‘tc_event_terms’ is used to display the terms and conditions of an event. When this shortcode is embedded in a post or page, it fetches the terms of the event linked to the post or page ID. If an ‘id’ attribute is provided, it will fetch the terms for that specific event. The result is then filtered and formatted for display.

Shortcode: [tc_event_terms]

Parameters

Here is a list of all possible tc_event_terms shortcode parameters and attributes:

  • id – It identifies the specific event in question

Examples and Usage

Basic example – The shortcode displays the terms and conditions of an event by referencing the event’s ID.

[tc_event_terms id=1 /]

Advanced examples

Using the shortcode without specifying the ID. In this case, the terms and conditions of the current post (event) will be displayed.

[tc_event_terms /]

Using the shortcode with a non-existent ID. If the specified ID does not exist, nothing will be displayed.

[tc_event_terms id=9999 /]

Using the shortcode with an ID that is not associated with an event. If the specified ID is not associated with an event, nothing will be displayed.

[tc_event_terms id=2 /]

PHP Function Code

In case you have difficulties debugging what causing issues with [tc_event_terms] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'tc_event_terms', array( &$this, 'event_terms' ) );

Shortcode PHP function:

function event_terms( $atts ) {
        global $post;
        extract( shortcode_atts( array(
            'id' => ''
        ), $atts ) );

        if ( empty( $id ) ) {
            $id = $post->ID;
        }

        $event = new TC_Event( $id );
        return apply_filters( 'tc_shortcode_event_terms', wpautop( $event->details->event_terms ), $event->details->event_terms );
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Tickera [tc_event_sponsors_logo] Shortcode

The Tickera Event Ticketing System shortcode, ‘tc_event_sponsors_logo’, is designed to display the logo of event sponsors. It retrieves the logo URL from the event details and generates an image tag. It accepts parameters for ‘id’, ‘class’, ‘width’, and ‘height’. If no ‘id’ is provided, it defaults to the current post’s ID. If a logo URL is not found, it returns an empty string.

Shortcode: [tc_event_sponsors_logo]

Parameters

Here is a list of all possible tc_event_sponsors_logo shortcode parameters and attributes:

  • id – The unique identifier for the specific event.
  • class – Specifies the CSS class of the sponsor logo image.
  • width – Controls the width of the sponsor’s logo image.
  • height – Determines the height of the sponsor’s logo image.

Examples and Usage

Basic example – The following shortcode displays the logo of the event sponsors, by referencing the event’s ID. If no ID is provided, the shortcode will default to the current post’s ID.

[tc_event_sponsors_logo id=2 /]

Advanced examples

Modifying the appearance of the sponsor’s logo by adding a custom class, and defining the image width and height. If the logo file URL is not empty, it will return an image tag with the specified attributes. If the URL is empty, it will return an empty string.

[tc_event_sponsors_logo id=3 class="custom_class" width="200" height="200" /]

Displaying the sponsor’s logo without specifying the event’s ID. In this case, the shortcode will use the ID of the current post. The class, width, and height parameters are also not specified, so they will default to ‘event_sponsors_logo’, ‘auto’, and ‘auto’, respectively.

[tc_event_sponsors_logo /]

PHP Function Code

In case you have difficulties debugging what causing issues with [tc_event_sponsors_logo] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'tc_event_sponsors_logo', array( &$this, 'event_sponsors_logo' ) );

Shortcode PHP function:

function event_sponsors_logo( $atts ) {
        global $post;
        extract( shortcode_atts( array(
            'id' => '',
            'class' => 'event_sponsors_logo',
            'width' => 'auto',
            'height' => 'auto'
        ), $atts ) );

        if ( empty( $id ) ) {
            $id = $post->ID;
        }

        $event = new TC_Event( $id );
        $img_scr = $event->details->sponsors_logo_file_url;

        if ( ! empty( $img_scr ) ) {
            return '<img src="' . esc_attr( $img_scr ) . '" width="' . esc_attr( $width ) . '" height="' . esc_attr( $height ) . '" class="' . esc_attr( $class ) . '" />';
        } else {
            return '';
        }
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Tickera [tc_event_logo] Shortcode

The Tickera Event Ticketing System shortcode, ‘tc_event_logo’, displays the logo of a specific event. It allows customization of the logo’s size and CSS class. The shortcode fetches the event’s ID, then retrieves and displays the event’s logo. If the logo’s URL is empty, it returns nothing.

Shortcode: [tc_event_logo]

Parameters

Here is a list of all possible tc_event_logo shortcode parameters and attributes:

  • id – It is the unique identifier of the event.
  • class – It assigns a CSS class to the event logo.
  • width – It sets the width of the event logo.
  • height – It sets the height of the event logo.

Examples and Usage

Basic example – The following usage of the shortcode will display the event logo of the current post or page, assuming it’s an event and has a logo assigned.

[tc_event_logo /]

Advanced examples

1. Displaying the logo of a specific event by specifying its ID. In this example, the event ID is 5.

[tc_event_logo id=5 /]

2. Customizing the size and CSS class of the logo. Here the width is set to 200 pixels, the height to 100 pixels, and the CSS class to ‘custom-logo’.

[tc_event_logo width="200" height="100" class="custom-logo" /]

3. Combining all the options. This example displays the logo of the event with the ID 5, sets its width and height to 200 and 100 pixels respectively, and assigns it the CSS class ‘custom-logo’.

[tc_event_logo id=5 width="200" height="100" class="custom-logo" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [tc_event_logo] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'tc_event_logo', array( &$this, 'event_logo' ) );

Shortcode PHP function:

function event_logo( $atts ) {
        global $post;
        extract( shortcode_atts( array(
            'id' => '',
            'class' => 'event_logo',
            'width' => 'auto',
            'height' => 'auto'
        ), $atts ) );

        if ( empty( $id ) ) {
            $id = $post->ID;
        }

        $event = new TC_Event( $id );
        $img_scr = $event->details->event_logo_file_url;

        if ( ! empty( $img_scr ) ) {
            return '<img src="' . esc_attr( $img_scr ) . '" width="' . esc_attr( $width ) . '" height="' . esc_attr( $height ) . '" class="' . esc_attr( $class ) . '" />';
        } else {
            return '';
        }
    }

Code file location:

tickera-event-ticketing-system/tickera-event-ticketing-system/includes/classes/class.shortcodes.php

Conclusion

Now that you’ve learned how to embed the Tickera – WordPress Event Ticketing Plugin shortcodes, 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.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *