Okay
  Public Ticket #2575711
hide external link option
Closed

Comments

  •  1
    matosalbers started the conversation

    Hi there! Is there a way to use the same calendar with different capabilities in public view vs. paid content page? Allow me to explain better:

    I own an online school for which I need to display agendas when clases will take place. Currently I use your plugin to show currently enrolled students their meeting agendas and I use the "external link" option to have the events link direct to zoom meetings. So the student clicks on the event and they are redirected to the zoom connection. This calendar is placed on a paid-content part of our website, within an online lesson. 

    However, on the course sales page (public, not only enrolled students) i also like to display the dates so they can tell ahead of time (before buying the course) if they are going to be able to make it to online meetings. So the idea here is to ONLY SHOW DATES, and override the link option. They dont need to read anything special about the event, other than only see the dates and times when we are meeting, BUT I WOULD LIKE TO HIDE THE CLICK PORTION OF IT. 

    So, question is: is there a way, shortcode or otherwise, to hide or show the external link? that it, to have one calendar have the clickable option on one page, and then simply not be clickable somewhere else? I just want to avoid having to duplicate calendars for this since these are the exact same events. 

  •  877
    Zhivko replied

    There's no built-in parameter for this. You can extend the code to add it.

    Add following code in your theme or child-theme functions.php file:

    add_action('wp_footer', function() {
        global $post;
        if (!is_a($post, 'WP_Post') || !has_shortcode($post->post_content, 'stachethemes_ec')) {
            return;
        }
        ?>
        <script type="text/javascript">
            (function ($) {             $(function () {
                    if (typeof $.stecExtend === 'undefined') {
                        return;
                    }                 $.stecExtend(function (m) {
                        if ('1' === m.glob.options.hide_external_link) {
                            $.each(m.calData.eventsPool, function(){
                                this.link = '';
                            });
                        }
                    }, 'onAddToEventsPool');
                });         })(window.jQuery);
        </script>
        <?php
    });

    Now in your calendar's shortcode where you want to disable the external link buttons add following attribute:

    hide_external_link=1

    Example:

    [stachethemes_ec hide_external_link=1]



    Stachethemes Developer

  •  1
    matosalbers replied

    Excellent! Thank you, you were very kind. It worked perfectly. It is quite useful, I would suggest you add it to regular parameters. 

    I couldn't find any articles regarding this: Is it possible to show a message when calendar is empty (no events scheduled)? Something short like "Dates will be published soon" ? Thanks!

  •  877
    Zhivko replied

    We'll add this text in the next update.

    Meanwhile you could add following code in your active theme functions.php file:

    add_action('wp_footer', function() {
        global $post;
        if (!is_a($post, 'WP_Post') || !has_shortcode($post->post_content, 'stachethemes_ec')) {
            return;
        }
        ?>
        <script type="text/javascript">
            (function ($) {             $(function () {
                    if (typeof $.stecExtend === 'undefined') {
                        return;
                    }                 $.stecExtend(function (m) {                     if (0 === m.calData.eventsPool.length && m.$instance.$agenda.find('.stec-custom-text-no-events').length === 0) {
                            $('<p class="stec-style-title2 stec-custom-text-no-events">Dates will be published soon</p>')
                                    .appendTo(m.$instance.$agenda.find('.stec-layout-agenda-events-all'));
                        }                 }, 'afterFillEvents');
                });         })(window.jQuery);
        </script>
        <?php
    });



    Stachethemes Developer