Viewing 15 replies - 1 through 15 (of 19 total)
  • 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/

    Thread Starter smarru

    (@smarru)

    Thank you for the direction @agelonwl It worked!

    that’s great.

    Thread Starter smarru

    (@smarru)

    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

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

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

    Thread Starter smarru

    (@smarru)

    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!

    thx for updating

    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

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

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

    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!

    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.

    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!

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    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/

    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?

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘[Plugin: Events Manager] ICAL feed per event category’ is closed to new replies.