Tockify Events Calendar Shortcode

Below, you’ll find a detailed guide on how to add the Tockify Events Calendar 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 Tockify Events Calendar Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Tockify Events Calendar Plugin and the shortcodes it provides:

Plugin Icon
Tockify Events Calendar

"Tockify Events Calendar is a user-friendly WordPress plugin that helps you manage and display your events efficiently. Its intuitive interface makes scheduling events a breeze."

★★★★✩ (16) Active Installs: 2000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [tockify]

Tockify Events Calendar [tockify] Shortcode

The Tockify Events Calendar shortcode is a powerful tool that embeds a customizable calendar into your WordPress site. This shortcode merges user-defined attributes with default values, creating an embed string. This embed string is then inserted into the site’s HTML, displaying a calendar with the specified settings. It also includes a script that loads the calendar.

Shortcode: [tockify]

Parameters

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

  • calendar – Specifies the name of the calendar to be displayed
  • component – Determines the type of calendar component to be used

Examples and Usage

Basic example – A simple implementation of the ‘tockify’ shortcode. This will display the ‘spirited’ calendar in its default view.

[tockify /]

Advanced examples

Specify a different calendar and component. This will display the ‘holiday’ calendar in a ‘list’ view.

[tockify calendar='holiday' component='list' /]

Include additional attributes in the shortcode. This example will display the ‘sports’ calendar in a ‘mini’ view with additional data parameters.

[tockify calendar='sports' component='mini' data-tockify-theme='dark' data-tockify-language='es' /]

Remember, you can replace the ‘calendar’ and ‘component’ attribute values with the name of your desired calendar and view component respectively. The ‘data-tockify-theme’ and ‘data-tockify-language’ attributes are optional and can be used to customize the appearance and language of your calendar.

PHP Function Code

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

Shortcode line:

add_shortcode('tockify', 'tockify_func');

Shortcode PHP function:

function tockify_func($atts)
{
    $atts = array_merge(array(
        'calendar' => 'spirited',
        'component' => 'calendar'
    ), $atts);

    $embedstring = "<br><div";
    foreach ($atts as $key => $value) {
        $embedstring .= " data-tockify-" . $key . "=\"" . $value . "\"";
    }
    $embedstring .= "></div>";
    $embedstring .= "<script type='text/javascript'>";
    $embedstring .= "if (window._tkf && window._tkf.loadDeclaredCalendars) {";
    $embedstring .= "window._tkf.loadDeclaredCalendars();}</script>";
    return $embedstring;
}

Code file location:

tockify-events-calendar/tockify-events-calendar/shortcode.php

Conclusion

Now that you’ve learned how to embed the Tockify Events Calendar 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.

Comments

Leave a Reply

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