Okay
  Public Ticket #2069432
Shortcode for indivual Link-Bahvior for each Event
Closed

Comments

  •  3
    Alexander started the conversation

    Hi Guys,

    i am searching an oppurtunity to create a different behavior to open a Link at different Events. By Example:

    - If i click a Event A, the Event A opens at a Single Page

    - If i click Event B, Event B opens in a PopUp

    - If i click Event C, it opens a External Link

    Can i influence this by shortcode?

    Cause i can just set a Global Behavior for all Events. 

  •  785
    Zhivko replied

    With shortcode no, but you could via js filter in your theme functions.php file.

    Example:

    add_action('stec_after_html', function() {
        ?>
        <script type="text/javascript">
            (function ($) {
                $.stecExtend(function (m) {
                    m.$instance.on(m.helper.clickHandle(), '.stec-layout-event-preview', function () {
                        var $event = $(this).parents('.stec-layout-event').first();
                        var eventId = parseInt($event.data('id'), 10);                     // Events with ids 1 2 and 3 will open in external link
                        var openInExternal = [1, 2, 3];                     // Events with ids 4,5,6 will open in single page
                        var openInSinglePage = [4, 5, 6];                     if (-1 !== $.inArray(eventId, openInExternal)) {
                            m.glob.options.general_settings.open_event_in = 'external';
                            return;
                        }                     if (-1 !== $.inArray(eventId, openInSinglePage)) {
                            m.glob.options.general_settings.open_event_in = 'single';
                            return;
                        }                 });
                });
            })(jQuery);
        </script>
        <?php
    });


    Change the values for 

    var openInExternal = [1, 2, 3];

    and 

    var openInSinglePage = [4, 5, 6];
    

    to the corresponding events' ids


    In your calendar settings set Open Events In to "popup".




    Stachethemes Developer