WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] ICAL feed per event category (20 posts)

  1. smarru
    Member
    Posted 2 years ago #

    Can anyone please help me with ical feed per event category.

    Is there a way to get the ics file per event category? I was able to get the all events ics file and individual ics file.

    Can you please me let me if this is available is PRO version or open source version?

    Thank you,
    SM

    http://wordpress.org/extend/plugins/events-manager/

  2. agelonwl
    Member
    Posted 2 years ago #

    You can do it by editing the ical template templates/ical.php and add a search attribute e.g. 'category'=>'7'

    http://wp-events-plugin.com/documentation/using-template-files/
    http://wp-events-plugin.com/documentation/event-search-attributes/

  3. smarru
    Member
    Posted 2 years ago #

    Thank you for the direction @agelonwl It worked!

  4. agelonwl
    Member
    Posted 2 years ago #

    that's great.

  5. smarru
    Member
    Posted 2 years ago #

    Hi agelonwl,

    I upgraded the Events manager plugin to the latest version 5.1.3 and tried to use the search attribute e.g. 'category'=>'7'. But by using this search attribute in the ical.php file, the events.ics file returns no events at all in a category page.

    Can you please help?

    Thank you,
    SM

  6. agelonwl
    Member
    Posted 2 years ago #

    that's weird, it's working fine on my test site. Can you post the code you are using?

  7. agelonwl
    Member
    Posted 2 years ago #

    also, if you can post a step by step guide.

  8. smarru
    Member
    Posted 2 years ago #

    Sorry about not checking for so long. I checked and the category is working. I was making changes to the ical.php in the main plugins folder. And I saw that ical.php file in my theme folder was overriding the actual file in plugins folder.

    Thanks again for your help!

  9. agelonwl
    Member
    Posted 2 years ago #

    thx for updating

  10. aliferis
    Member
    Posted 2 years ago #

    Hello - great plugin. Testing free version with a view to getting pro.

    I have a question related to ical feeds - I can see how to create a link to an ics file - but how can I create a link to a dynamic ical feed ?

    ie. si the user can subscribe to the feed in a desktop app like iCal or Lightning ?

    Thank you

    Joe

  11. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    for that you'd use yoursite.com/events.ics

  12. Z-247
    Member
    Posted 2 years ago #

    Sorry for the bump, but I'm trying to follow this, and I'm not sure where the category search should be added to the ical.php file.

    as per smarru's blog post, I started with getting the category id:

    $uri=$_SERVER['REQUEST_URI'];
    $args=explode('/',$uri);
    
    /* Get the category ID */
    if($args[1]=='events' && $args[2]=='categories') { $cat_name=$args[3]; $cat_obj=get_term_by('name', $cat_name , 'event-categories'); $cat_id=$cat_obj->term_id; }

    But then I'm unsure on how/where to use $cat_id there. Should it be replacing 'event_id' here?

    if( !empty($_REQUEST['event_id']) ){
    	$EM_Events = array(new EM_Event($_REQUEST['event_id']));
    }else{
    	$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') )) );
    }

    or should 'category'=>$cat_id go in as part of the 'get(apply_filters(' array? And is it safe to assume that this won't replace the default, root .ics functionality, right?

    Thanks for spelling it out a little more!

  13. agelonwl
    Member
    Posted 2 years ago #

    you should add it inside the array

    e.g.
    array('limit'=>get_option('dbem_ical_limit'),'category'=>'7',... where "7" is the category id.

    and yes it wont replaced the default functionality.

  14. Blake Imeson
    Member
    Posted 1 year ago #

    So to add ical feeds for categories you need to hard code in the actual category IDs into the template? On the site I am working on that wouldn't be bad as there are only like 5.

    My next question is a big one - is it possible to create a way to have ical feeds for event tags? So for instance we are wanting to tag events with the company names and then be able to display those on a company profile page and maybe even allow the company to use the ical feed on their own site.

    Is this possible? We're totally willing to fund development if so.

    Thanks!

  15. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    You'd need to edit the template file, but it's possible. Can't do this ourselves anytime soon but it's fairly easy to do with a little php know-how

    The line specifically you want to edit is templates/templates/ical.php 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') )) );

    e.g. add 'category'=>'x' and you'd only see the categories you want. Make it dynamic by passing it on in the url.

    for using template files - http://wp-events-plugin.com/documentation/using-template-files/

  16. BertvanDorp
    Member
    Posted 1 year ago #

    I've got the feeling I'm the only guy who doesn't get it to work.. I feel Im close though; probably some syntax thing? I inserted smarru's code into my template/ical.php as follows:

    $uri=$_SERVER['REQUEST_URI'];
    $args=explode('/',$uri);
    
    /* Get the category ID */
    if($args[1]=='events' && $args[2]=='Kerkdiensten') {
    	$cat_name=$args[3];
    	$cat_obj=get_term_by('name', $cat_name , 'event-categories');
    	$cat_id=$cat_obj->term_id;
    }

    And I altered the array by using:
    $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' )) ); at (previous) line 13, as given by Marcus.

    By the way: 'Kerkdiensten' is the name of the category. I'm now trying to retrieve the .ICS using the link: [site]/index.php/events/Kerkdiensten/events.ics. It does not matter if I use [site]/index.php/events/Kerkdiensten//events.ics

    However, this still returns all events, not just from this category. Am I overlooking something here?

  17. BertvanDorp
    Member
    Posted 1 year ago #

    My permalinks are different, and so I tried shifting the &args[1] around, didn't work. Does anyone know how I can get PHP to display what value of cat_id it found?

  18. BertvanDorp
    Member
    Posted 1 year ago #

    Followed Smarru's work closer, by using the code from the site and inserting the categories like: [site]/index.php/events/categories/Kerkdiensten/events.ics. Still no results.

    Also tried adjusting the search array, using
    $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' => get_option('category') )) ); and [site]/index.php/events/events.ics?category=[id]. Didn't work as well.

  19. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    a good starting point would be to check if it's a taxonomy with is_tax

    not entirely sure if that'll work though... haven't tried this myself.

  20. BertvanDorp
    Member
    Posted 1 year ago #

    I got it to work, just replied on the first thread!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic