Support » Plugin: Events Manager » Request: ICS Export per category

  • Resolved BertvanDorp


    Using the Events Manager for a month now, and love the simplicity, extendibility and just the fact that someone made this for me to use 🙂 Thanks!

    As of now, there’s multiple .ICS export locations:

    • [site]/index.php/events/events.ics
    • [site]/index.php/events/[events-category]/events.ics

    However, both of these files/links produce the same calendar, with all of the events. I’d like to be able to export just a certain category, and I’m willing to pay someone for this functionality as well as I’m not really experienced with JavaScript and PHP as of now. I’m assuming it’s a matter of implementing a filter in the export functionality?

    Thanks in advance. And keep up the great work!

    EDIT: from another thread, I learned that the iCal output is being generated with /template/ical.php

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Marcus


    NetWebLogic Support

    at the moment, there isn’t any function in EM to exports feeds with only one category, you’d need to modify the ical templates

    wasn’t aware that both urls would produce an ical, i think that’s just a coincidence, but maybe something we can take advantage of in the future when implementing this feature 🙂

    @agelonwl thanks! will look into it. Seems I need to add arguments to the call, and filter based on the category in the argument.

    @marcus: I guess this will provide helpful for a lot of users, as the site can actually offer a limited subscription. I don’t have the time nor the resources to tackle this for the coming months. However, I’m willing to look into the filtering, see if there’s a way. Do you have any pointers on using the fact that the category also generates the ical needed?

    Followed up in the other thread: click.

    Whoa, I got the thing to work! Thanks to the other thread and some trial-and-error on formatting. Funny thing is that this way actually uses the name of the category to generate the category id and filter on this, so this can be used as a general implementation! I added handling for permalinks as well. Here’s the code:

    /* Get the category ID */
    /* handling different permalinks */
    if ($args[1]=='index.php') {
    /* retrieve category ID from WP Events Manager DB */
    if($args[$start_index_URI]=='events' && $args[$start_index_URI + 1]=='categories') {
    	$cat_name=$args[$start_index_URI + 2];
    	$cat_obj=get_term_by('name', $cat_name , 'event-categories');

    and the loop on (former) line 13:
    $EM_Events = EM_Events::get(apply_filters('em_calendar_template_args',array( 'limit'=>get_option('dbem_ical_limit'), 'owner'=>false, 'orderby'=>'event_start_date', 'scope' => get_option('dbem_ical_scope'), 'category'=>$cat_id )) );

    So, there’s now three ways to get an export:
    1. per event
    2. per category: [site]/events/categories/[category name]/events.ics
    3. whole calendar: [site]/events/events.ics

    Marcus, I guess this is something you can just implement and document? It also works with different permalinks, as stated before.

    Plugin Author Marcus


    NetWebLogic Support

    glad you got it working on your site but to implement this, problem with the above is it probably won’t not work in all cases, e.g. if permalinks are disabled. we’d need to look at $WP_Query and decide that way.

    since you can override the ical template I advise you copy that to your theme so you won’t lose changes on updates

    Did that, thanks Marcus!



    I’ve been trying to get this to work but can’t see whereabout in the ical.php file I would need to place this code. Any chance of a pointer?

    Thank you in advance,


    Plugin Author Marcus


    NetWebLogic Support

    probably first snippet at the top of the file, then the second bit on the line he mentioned (you probably replace a line there)

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Request: ICS Export per category’ is closed to new replies.