Support » Plugins » [Plugin: Events Manager] Calendar Function – AJAX function or Classes help

  • How you doing?

    I’m using the beautiful Events Manager plugin to display a calendar of upcoming events. I want to be able to highlight each category with a different colour on the calendar.

    I tried to add categories as a class in the template but EM only outputs them as an unordered list.

    My workaround was to populate a hidden DIV with the categories and use jQuery to generate classes off the back of that.


    <li><a href="#_EVENTURL"><span>#_24HSTARTTIME</span> <strong>#_NAME</strong></a> <div class="eventcats">#_EVENTCATEGORIES</div></li>


    if ( $j('.em-calendar-wrapper').length ) {
    	$j('.eventful > ul li, .eventful-today > ul li').each( function() {
    		var cats = '';
    		$j(this).find('.eventcats ul li').each( function() {
    			catit = $j(this).find('a').text();
    			cats = cats + catit.toLowerCase().replace(/ /g, '-') + ' ';
    		cats = $j.trim(cats);

    This works, but the problem is that when you change month then the calendar updates with AJAX, and as the above jQuery is running on (document).load then it resets when the month is changed.

    So my question is: Can I pass my function into the AJAX on change somewhere, or better still, is there a way to add clean classes based on categories into the calendar item template?

    I know you guys that run EM love taking on board suggestions so I thought I’d post here and try my luck.

    Hope someone can help.


Viewing 3 replies - 1 through 3 (of 3 total)
  • Ok I’ve managed to hack my function into the events-manager.js file and it works, but this is obviously very bad practice as it will break when the plugin updates.

    So any suggestions on another way to do this would be awesome like awesome sauce.





    actually, an event is triggered –


    you can just bind to that in jquery

    Thanks so much for your help Marcus. I’d never binded a function to an event before so I had to do some Googling.

    Came up with

    $j(document).bind('em_calendar_load', function() { calColours(); });

    Worked like a charm.

    Still think that there’s room for a way to add classes for even categories though. It will help with styling and therefore usability.


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Events Manager] Calendar Function – AJAX function or Classes help’ is closed to new replies.