Adding extra information for the event

Tickera's event pages already contain several useful fields for the information about your event: event location, event logo, sponsor's logo, as well as the content area where you can literally enter anything you want just like you would do on any other WordPress page or post.

But let's imagine that you would like to have some dedicated, extra field where you can add some extra information about the event which you can later display with the shortcode. For the purpose of this example, let's assume that you want to enter Facebook page of your event and want to call it back using shortcode.


Creating the field

So, first thing we need to do is to create this extra field. To do this, you can either add the following code to your functions.php, use some third party plugin for adding code snippets (such as the one found here ) or, why not, create custom add-on out of it:

add_filter( 'tc_event_fields', 'tc_modify_event_fields', 10, 1 );

function tc_modify_event_fields($fields) {
    $fields[] = array(
        'field_name' => 'event_facebook',
        'field_title' => __('Facebook Page', 'tc'),
        'field_type' => 'text',
        'field_description' => __('Add facebook page for the event', 'tc'),
        'table_visibility' => true, 'post_field_type' => 'post_meta' 
return $fields;

With this, you will notice that now once you start creating new event or edit the existing one, there is another field all the way down which is labeled Facebook Page. Of course, if you will be using this for something else you can make changes to the following values:

  • 'field_name' - it is the name of the field in the database where we'll be storing this post meta. If you will be creating multiple extra fields, make sure that this value is different for each. We have used here the value 'event_facebook' which seemed logical for this purpose but you can name it any way you like. Just don't forget single quotation marks around it and make sure it doesn't have any blank spaces.
  • 'field_title' -  this is the label which will be located right next to the text field. We have used here 'Facebook Page' but you can change it to anything you like (single quotation marks must remain around it)
  • 'field_description' - this is the description of the field which will appear on the right side of the field. This is not mandatory value and if don't want it, you can remove this whole line

The rest should remain unchanged.


Field callback using shortcode

Now, once we have created this field, we've actually added another post meta to the event post type where we'll be storing extra information. But, it's of little use just to have it visible in the database, so we'll now need a way to show it on the front end.

So, let's create a shortcode which will display this information based on the ID of the event. To do this, use the following code, right below the place where you have entered the previous snippet:

add_shortcode( 'tc_event_facebook', 'tc_event_facebook' );

function tc_event_facebook($atts) {
        'id' => '' 
                    ), $atts)); 
    return get_post_meta($id, 'event_facebook', true); 

Once done, you will be able to use shortcode [tc_event_facebook id="123"] where 123 shout be changed with the ID of your event (you can find your event ID by navigating to the Events area of Tickera where all the existing events are listed). Of course, quotation marks around the ID should remain.

Aaaaaand that's basically it 🙂


Wrapping it up (and sugar coating it as well)

However, to make things a bit more easier, we will attach an add-on to this post which contains all of this in form of a custom add-on which you can install on your website right away and use it "as-is". Surely, you can make changes to it the code of this add-on as described previously and then install and activate it on your website. We have commented each line where you can make changes.

The add-on is installed like any other WordPress plugin and will work regardlessly whether you're running Tickera as a standalone or alongside WooCommerce via Bridge for WooCommerce.




If, however, you do not feel comfortable making changes yourself or don't really get how all this works (yeah, we understand that whole lotta code mumbo jumbo might be a bit intimidating if you're not used to it), please submit a support ticket to with detailed description of what you're aiming towards, and our support agents will help you out.







Leave Us A Message!