Okay
  Public Ticket #2350375
Small onAIR extension for radio stations
Closed

Comments

  •  1
    Jessy started the conversation

    Good day everybody,

    would it be possible that you could possibly add a small extension to the calendar for radio stations?

    That, just like the "Reminder", you can insert an info text that instead of "Trendy" then reads "Now running" or "Now onAIR". And can adjust the background color. That this info e.g. Is highlighted in green.

    The information should then always be displayed as soon as an event or a broadcast begins. Is then displayed for the next event / broadcast. And so on.

    Would be really great if you could program something like that as a small update. :-)

    With the best German greetings

    Jessy Dürholt
    ANTENNA INGOLSTADT Indentantin

  •  877
    Zhivko replied

    Hi,

    I've written small code that will add "Now onAIR" tag above the title when the event is in progress. 

    You can add the code in your theme functions.php file at the bottom:

    add_action('wp_footer', function() {
        ?>
        <script type="text/javascript">
            (function ($) {             var html, pCSS, spanCSS;             pCSS = 'float: left; line-height:1;';
                spanCSS = 'background: #f15e6e; color: #fff; padding: 3px 6px; border-radius: 3px; font-size: 10px; margin-right: 5px;';
                html = '<p style="' + pCSS + '"><span style="' + spanCSS + '">Now onAIR</span></p>';             // In calendar fn
                if (typeof $.stecExtend === 'function') {
                    $.stecExtend(function (m) {                     m.$instance.on('stecBeforeReturnEventPreviewHtml', function (e, data) {                         var $preview, state;                         state = m.helper.getEventState(data.event);                         if (1 !== state) {
                                return;
                            }                         $preview = $(data.temp.EventPreviewHtml);                         $(html).prependTo($preview.find('.stec-layout-event-preview-left-text'));                         data.temp.EventPreviewHtml = $preview.get(0).outerHTML;
                        });                 });
                }             // Single page fn
                if ($('.stec-layout-single').length > 0) {                 var glob, helper, state, offset;                 glob = {
                        options: window.stecSingleOptions,
                        event: window.stecSingleEvent
                    };
                    
                    glob.event.start_date_timestamp = moment.tz(glob.event.start_date, glob.event.timezone).unix();
                    glob.event.end_date_timestamp = moment.tz(glob.event.end_date, glob.event.timezone).unix();                 helper = new window.StecHelper();
                    helper.set('glob', glob);
                    
                    offset = parseInt(window.stecSingleOptions.repeat_offset, 10);
                    state = helper.getEventState(glob.event, offset);
                    
                    if (1 !== state) {
                        return;
                    }
                    
                    $(html).prependTo($('.stec-layout-single').find('.stec-layout-single-preview-left-text'));
                }         })(window.jQuery);
        </script>
        <?php
    }, 9999);

    Stachethemes Developer

  •  1
    Jessy replied

    Yes, that's exactly how it should look. :-)

    Somehow the script doesn't work for me.

    I did it in functions.php as described.
    In the end, so to speak.

  •  877
    Zhivko replied

    Is it possible to provide me with link to the front-end where the calendar reside?


    Stachethemes Developer

  •  1
  •  877
    Zhivko replied

    I don't seem to have problems? Screenshot attached.


    Stachethemes Developer

  •  1
    Jessy replied

    It doesn't appear to me at all.

    Neither Google Chrome nor Edge.

    Now it's getting mysterious * g

  •  877
    Zhivko replied

    It could be browser cache.

    There's another thing I've noticed. Your events are in UTC timezone. What timezone should your events be in?


    Stachethemes Developer

  •  1
    Jessy replied

    For German. I think UTC then?

  •  1
    Jessy replied

    No GMT then or?

  •  877
    Zhivko replied

    I think it should be Europe/Berlin (UTC/GMT +02:00)


    Stachethemes Developer

  •  1
    Jessy replied

    Yes exactly

  •  1
    Jessy replied

    ahhh yeah it runs.

    super thank you :-)