Return to Snippet

Revision: 55659
at February 16, 2012 03:24 by nciske


Initial Code
add_filter('tribe_ical_feed_item','tribe_add_attachment_to_ical', 10, 2);

function tribe_add_attachment_to_ical($item, $event){

	$args = array(
		'post_type' => 'attachment',
		'numberposts' => -1,
		'post_status' => null,
		'post_parent' => $event->ID
	);
	
	$size = 'full';
	
	$attachments = get_posts($args);
	if ($attachments) {
		foreach ($attachments as $attachment) {
			$item[] = "ATTACH:".wp_get_attachment_image_src($attachment->ID, $size);		
			
		}
	}

	return $item;
}

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

Initial Description
Requires filter added in ECP 2.1

Initial Title
Add attachments to Events Calendar Pro (2.1) iCal feed

Initial Tags
php, filter

Initial Language
PHP