Support

Home Forums Events Calendar Add-on Add availability and colour to calendar entries

Add availability and colour to calendar entries

Posted: October 9, 2013 at 10:13 am


Michael Byrne

October 9, 2013 at 10:13 am

I am looking for some advice on further customising the display of the Event Calendar addon.

If you have a look at this screenshot you can see what I have done so far:
https://dl.dropboxusercontent.com/u/1019023/santa.jpg

There are 2 additional updates I would like to make:

1. Display the number of spaces available on the Calendar underneath the event title so the visitor does not have to over over the event to see how many spaces are available.

2. Apply a colour to the events which have 10 or less spaces available.

Any advice would be appreciated. Also complete solutions will be gratefully accepted 🙂

Thank you…


Dean

October 10, 2013 at 1:28 am

Hi Michael,

This would require some custom developemnt, as you would be editing core files (updates will over write your changes).

1) You could use a system similar to what Sidney outlined here https://eventespresso.com/topic/can-the-calendar-display-what-citylocation-each-event-is-held-in/ but instead of the venue shortcode you could use the Attendee numbers shortcode https://eventespresso.com/wiki/shortcodes-template-variables/#attendee-numbers

2) Well, this is what I would do, the codes a bit rough though

In the espresso calendar there is this code at line 291 approx

if( isset( $category_data['category_meta']['use_pickers'] ) && $category_data['category_meta']['use_pickers'] == 'Y' ){
				$eventArray['color'] = $category_data['category_meta']['event_background'];
				$eventArray['textColor'] = $category_data['category_meta']['event_text_color'];
			}

change it to

$ee_test = do_shortcode('[ATTENDEE_NUMBERS event_id="' . $event->id . '" type="available_spaces"]');
			if($ee_test == "Unlimited") { $ee_test = 10000;}
			if($ee_test <= 10) { //the remaining spaces threshold
				$eventArray['color'] = "#000"; //background colour
				$eventArray['textColor'] = "#fff"; //text colour
			}
			elseif( isset( $category_data['category_meta']['use_pickers'] ) && $category_data['category_meta']['use_pickers'] == 'Y' ){
				$eventArray['color'] = $category_data['category_meta']['event_background'];
				$eventArray['textColor'] = $category_data['category_meta']['event_text_color'];
			}

This basically gets the available spaces, converts Unlimited to a high number for ease and will add hard coded styles. It will also ignore category colouring if below that mark.

Please note that the code is an example only and is not supported. Use at your own risk.


Michael Byrne

October 11, 2013 at 8:24 am

Hi Dean,

thanks for your help.

I have got the colouring of events with limited availability to work successfully.

And I have the code to display the number of spaces working, but your suggestion does not display it in the correct place – for me. I want to put it underneath the event title on the calendar. Your code puts it on the tooltip popup.

I’ve had a good search but can’t figure out where it should go. Can you offer any advice?


Michael Byrne

October 14, 2013 at 2:01 am

Hi there,

sorry to do this, but I have a support query here for which I need an answer:

https://eventespresso.com/topic/add-availability-and-colour-to-calendar-entries/

Can you help?

Thanks…


Josh

  • Support Staff

October 14, 2013 at 10:24 am

Hi Michael,

Something like this will do display the attendee count below the title:

if ( event.attendee_limit ) {
  element.find('.fc-event-title').after($('<p class="attendee_limit_block">' + event.attendee_limit + '</p>'));
}

Please note:

If you customize and change the Calendar code from the defaults we’ve created and tested it becomes your job to maintain it. Therefore, we can’t provide detailed ongoing support for code customizations.

The support post ‘Add availability and colour to calendar entries’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso