Plugin Author
room34
(@room34)
Unfortunately I have yet to find a source calendar program that actually includes the categories in its output, so I haven’t added support for it. Can you share your feed URL? (You can email it to the address on the plugin’s admin page if you don’t want to post it here.) I’ll have a look at the raw data in the feed and see if the category is present… but it most likely isn’t.
Hi,
thanks for the quick reply.
Here is the feed URL: https://5knoten.de/civicrm/event/ical/?reset=1&list=1
Plugin Author
room34
(@room34)
Thanks for sharing your feed. I do see the CATEGORIES
field in the output. That’s a first!
My approach to development is always to have an example of a live feed to work from, so I can verify that the code is working as it should with “real world” data. I can use this as a starting point to add this functionality.
One thing I noticed — the feed example you sent only has 3 events and they all have the same category. Do you have another feed with more events, in different categories? That would be a better example to test with.
It would be superb if this feature was added 🙂
Unfortunately, I cannot add more events to the feed as it is ‘real world data’ as you say. I’ve added a test event for a short time to check whether different categories are actually put out if I change its type and it does actually put out the correct value in the CATEGORIES
property of the feed.
So the CATEGORIES
property seems to be working fine, I just cannot filter by it for now.
Hi again,
I actually changed the category of one of the three events in the feed to ‘Meeting’. Hope, that helps!
Plugin Author
room34
(@room34)
I’m currently checking in version 9.4.1, which is adding some stub functionality for categories. It does not yet modify any visual output of the feed, but it makes two important changes:
1. If an event has CATEGORIES
data, there is a data-categories
attribute added to the HTML tag for its .event
wrapper element.
2. The CATEGORIES
data is also added to the individual event download (when eventdl="true"
is set in the shortcode).
The data-categories
attribute allows for custom CSS/jQuery manipulation. For example, you could change the background color on elements in a given category with CSS like this:
.ics-calendar .event[data-categories*="Workshop"] {
background: #99cc99;
}
-
This reply was modified 2 years, 1 month ago by room34.
Hi,
thank you for your reply!
Our version is indeed older than that. WP is offering to update straight to version 9.5.3. Is the functionality still included in this one or should I rather try and update to the exact version you mentioned?
If yes, where would I find it?
Thanks again for your help.
Plugin Author
room34
(@room34)
@jenniferrr You should always update to the latest version.
Thank you, that did work.
However, there is another problem where the data-categories
attribute is only added for .event (and .time). If I want to hide (“filter”) an event by using this attribute in the CSS then the event wrapper will still display with the date minus the event title and description. Is there a way to hide the entire event wrapper?
For example could the attribute data-categories
be added to the .ics-calendar-date-wrapper
class?
Plugin Author
room34
(@room34)
Ah, yes… I can see how that would be a problem. The changes I made for inserting the category data into the HTML are kind of just the first step in an overall solution though.
I don’t think it would work to just put data-categories
on the .ics-calendar-date-wrapper
element because a date wrapper might contain events from multiple categories.
I think the best solution would be to use jQuery on page load to hide the headers for any dates that don’t have any visible events.
There’s already a jQuery function built into the plugin that almost does this — r34ics_show_hide_headers()
— but it’s coded in a way that is a bit too restrictive for it to catch this situation. I’m going to test some revisions to see if I can make it be the solution to this problem.
Plugin Author
room34
(@room34)
OK… watch for version 9.5.4 to be available momentarily.
The only significant change here is that r34ics_show_hide_headers()
has been modified to look for .event:visible
instead of .event:not([style*="none"])
as it was before. This provides more flexibility to hide events with CSS classes or in your main stylesheet, rather than just the inline CSS the plugin generates as users interact with the toggles (which was the function’s original purpose).
I also set it to fire off on the initial page load, which it was not previously doing.
I haven’t been able to test it with data-categories
specifically, but my test scenario should be equivalent, so I think this will resolve the issue for you. It’s possible you may need to do a bit of trial and error, but if you’re not able to get this working, let me know.
Hi!
Apologies for the late reply, I was out of office in the last two weeks.
I downloaded your update and tried again and it works perfectly now!
Thank you very much for your assistance I really appreciate it.
Is there a way I could sponsor you a coffee break or something?
Many thanks again!
Plugin Author
room34
(@room34)
Thanks, I’m glad to hear this resolved the issue!
If you feel so inclined there’s a donation link on the admin page of the plugin. 😉 You may also want to check out the pro version: https://icscalendar.com