Posted By

nciske on 02/16/12


Tagged

php filter modern tribe


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

adeg
bitsculptor


Add attachments to Events Calendar Pro (2.1) iCal feed


 / Published in: PHP
 

URL: http://tri.be/support/forums/topic/ical-export-does-not-include-attached-images/

Requires filter added in ECP 2.1

  1. add_filter('tribe_ical_feed_item','tribe_add_attachment_to_ical', 10, 2);
  2.  
  3. function tribe_add_attachment_to_ical($item, $event){
  4.  
  5. $args = array(
  6. 'post_type' => 'attachment',
  7. 'numberposts' => -1,
  8. 'post_status' => null,
  9. 'post_parent' => $event->ID
  10. );
  11.  
  12. $size = 'full';
  13.  
  14. $attachments = get_posts($args);
  15. if ($attachments) {
  16. foreach ($attachments as $attachment) {
  17. $item[] = "ATTACH:".wp_get_attachment_image_src($attachment->ID, $size);
  18.  
  19. }
  20. }
  21.  
  22. return $item;
  23. }

Report this snippet  

You need to login to post a comment.