Okay
  Public Ticket #3383872
Current period
Closed

Comments

  •  2
    Artyom started the conversation

    Hi,
    I have a two questions:
    1. How can I use shortcodes to display events with past start dates only those whose end date has not yet arrived? That is, the event started on 01.03. and should end on 01.06. and now it is 01.05. And this event should be displayed. Another event from 01.03 to 01.04 should not be displayed. 
    2. How can I disable the image only in the mobile version of the Agenda format drop-down event?

    Thanks in advance.

  •  785
    Zhivko replied

    Hi,

    Sorry for the delay.

    1. It appears you want to display only events that are in progress. By default there is no such filter included so you will have to add following hook in your theme or child-theme functions.php file:

    // STEC MOD: Register in_progress filter
    add_action('wp_footer', function () {     if (!wp_script_is('stec-js')) {
            return;
        }     ?>     <script type='text/javascript'>
            (function($) {             $(function() {                 $.stecExtend(function(m) {                     if ('1' !== m.glob.options.in_progress) {
                            return;
                        }                     m.calData.filterGetEvents = m.calData.filterGetEvents.filter(function(event) {                         var startDate = moment.tz(event.start_date, event.timezone);
                            var endDate = moment.tz(event.end_date, event.timezone);
                            var now = new moment();                         if (now.isBetween(startDate, endDate)) {
                                return true;
                            }                         return false;                     });                 }, 'beforeReturnGetEvents');             });         })(jQuery);
        </script> <?php });

    After this hook is inserted add to your shortcode "in_progress=1" like following:

    [stachethemes_ec in_progress=1]

    2. Go to Dashboard -> STEC -> Fonts & Colors -> Custom style tab and insert this style:

    .stec-layout-single-media-small .stec-layout-single-media,
    .stec-media-small .stec-layout-event-inner-intro-media {
        display: none !important;
    }



    Stachethemes Developer

  •  2
    Artyom replied

    Thank you! 

    I installed the shorcode, but now it only shows current events in progress. And how can I make it show events in progress (with past start date) along with all upcoming events? 

  •  785
    Zhivko replied

    Okay, in that case replace following lines of the code:

                            if (now.isBetween(startDate, endDate)) {
                                return true;
                            }    

    with:

                            if (now.isBetween(startDate, endDate) || now.isBefore(startDate)) {
                                return true;
                            }



    Stachethemes Developer

  •  2
    Artyom replied

    Thank you, Zhivko!