Okay
  Public Ticket #1903691
Disable automaticly the booking option when event start
Closed

Comments

  • Tessera Multimedia started the conversation

    Hello,

    is possible to disabled automaticly the booking option when event starts?


    Best Regards,


  •  877
    Zhivko replied

    Hi,

    Add this code in your theme functions.php file:

    add_action('wp_footer', function() {
        ?>
        <script type="text/javascript">
            (function ($) {
                $('.stec').on('onEventToggleOpen', function (e, m) {
                    var now = Math.floor(new Date().getTime() / 1000);
                    if (parseInt(m.event.start_date_timestamp, 10) + parseInt(m.repeatOffset, 10) < now) {
                        m.$instance.find('.stec-layout-event.active').find('.stec-form-booking').remove();
                    }
                });
            })(jQuery);
        </script>
        <?php
    }); add_action('stec_single_after_content', function() {
        ?>
        <script type="text/javascript">
            (function ($) {
                var now = Math.floor(new Date().getTime() / 1000);
                var eventTime = window.moment(stecSingleEvent.start_date).add(stecSingleOptions.repeat_offset, 'seconds').unix();
                if (eventTime < now) {
                    $('.stec-form-booking').remove();
                }
            })(jQuery);
        </script>
        <?php
    });




    Stachethemes Developer