Okay
  Public Ticket #1851012
Single event color equal event category color
Closed

Comments

  •  2
    tsvrb started the conversation

    Hi again,

    is it possible to set event category color instead of calendar color as default for single events?


  •  878
    Zhivko replied

    Hi,

    Replace file stachethemes_event_calendar\front\view\single.php with the one I've attached.


    Stachethemes Developer

  •  2
    tsvrb replied

    Hi,

    can not see difference. Calendar color is still as default color for single event.

  •  94
    Valentin replied

    Can you give me ftp access to the files to do it for you? You can post here privately.

    Stachethemes Support
    My Time Zone is GMT+3


    Envato Profile | Facebook | Twitter | Newsletter | Rate & Review

  •   tsvrb replied privately
  •  878
    Zhivko replied

    [email protected]

    Direct FTP access is safer since any php typo could produce an error which cannot be undone from the admin but I'll try be careful.


    Stachethemes Developer

  •   tsvrb replied privately
  •  878
    Zhivko replied

    Hi,

    I've added additional code to your theme functions.php file:

    add_action('wp_footer', function() {
        ?>
        <script type="text/javascript">
            (function ($) {
                if (typeof $.stecExtend !== 'function') {
                    return;
                }
                $.stecExtend(function (master) {
                    $.each(master.calData.eventsPool, function () {
                        if (this.category.length > 0) {
                            this.color = this.category[0].color;
                        }
                    });
                }, 'onAddToEventsPool');
            })(jQuery);
        </script>
        <?php
    });

    This code changes the color of the events in the calendar as well.

    Single page code is working as intended: http://test02.igmetall.de/stec_event/test/


    Stachethemes Developer

  •  2
    tsvrb replied

    Thank you! Works fine.

    Maybe you can integrate this feature in your next update to be able to choos between calendar color or category color as .

    It is not uncommon to use category color as default ;-)

  •  878
    Zhivko replied

    You are right it's common for users to request this so we'll most like add it in the options.


    Stachethemes Developer