Okay
  Public Ticket #1965284
Monthly Tooltip - display category
Closed

Comments

  • Bev started the conversation

    Hi,

    I'm busy setting the events calendar up for a local club and they are wanting it set so that there are different categories for the different events that are on - ie: Annual General Meeting, Social Night, Quiz Night and so on.

    I have all the categories and events set-up, but I just wondered if there was some way to display the category in the tooltip that appears when you hover over the event in the month view (see attached image)??

    I've found the tooltip file in the plugin and can alter that, but don't really want to. So, is there a way I can add some code in the functions file to display it, or is there some way that I can have the tooltip template file in my child theme folder - and the plugin will use that one first??

    Thanks,

    Bev

  •  894
    Zhivko replied

    Hi,

    I've added small filter to the tooltip so you can edit it without changing the core code.

    The filter will be included in the next update so you can replace the tooltip.js file now with the attached one.


    I'm adding example code how you can add categories to the tooltip. 

    In your theme functions.php file add following action:

    add_action('stec_after_html', function() {
        ?>
        <script type="text/javascript">
            (function ($) {
                $.stecExtend(function (m, data) {
                    
                    var categoriesHtmlArray = [];                 if (data.event.category) {
                        $.each(data.event.category, function () {
                            categoriesHtmlArray.push('<span style="color:' + this.color + ' ">' + this.title + '</span>');
                        });                     var categoriesHtml = categoriesHtmlArray.join('');                     $('<div class="stec-tooltip-categories">' + categoriesHtml + '</div>')
                                .insertAfter(data.temp.$tooltip.find('.stec-tooltip-desc'));
                    }             }, 'filterTooltipHtml');
            })(jQuery);
        </script>
        <?php
    });

    Stachethemes Developer

  •  894
    Zhivko replied

    Just made a small change to the tooltip.js file again. Attaching the file.

    Example code:

    add_action('stec_after_html', function() {
        ?>
        <script type="text/javascript">
            (function ($) {
                $.stecExtend(function (m, data) {
                    
                    var categoriesHtmlArray = [];
                    if (data.event.category) {
                        $.each(data.event.category, function () {
                            categoriesHtmlArray.push('<span style="color:' + this.color + ' ">' + this.title + '</span>');
                        });
                        var categoriesHtml = categoriesHtmlArray.join('');
                        $('<div class="stec-tooltip-categories">' + categoriesHtml + '</div>')
                                .insertAfter(data.tooltip.find('.stec-tooltip-desc'));
                    }
                }, 'filterTooltipHtml');
            })(jQuery);
        </script>
        <?php
    });

    Stachethemes Developer