Permalink
Browse files

tagging version 1.0

  • Loading branch information...
1 parent 568747e commit dbd2f778e87430fba9f41a4c4403fc021c660bc6 aking committed Feb 1, 2009
Showing with 38 additions and 0 deletions.
  1. +38 −0 cf-media-rss.php
View
@@ -0,0 +1,38 @@
+<?php
+
+/*
+Plugin Name: Media RSS Image Links
+Description: Adds media RSS elements to your RSS2 feed for images attached to posts.
+Version: 1.0
+Author: Crowd Favorite
+Author URI: http://crowdfavorite.com
+*/
+
+function cf_media_rss_links() {
+ global $post;
+ $items = get_children(
+ array(
+ 'post_parent' => $post->ID
+ )
+ );
+ foreach ($items as $item) {
+ $info = wp_get_attachment_metadata($item->ID);
+ $thumb = wp_get_attachment_image_src($item->ID);
+ echo '
+<media:content
+ url="'.wp_get_attachment_url($item->ID).'"
+ type="'.$item->post_mime_type.'"
+ width="'.$info['width'].'"
+ height="'.$info['height'].'"
+/>
+<media:thumbnail
+ url="'.$thumb[0].'"
+ width="'.$thumb[1].'"
+ height="'.$thumb[2].'"
+/>
+ ';
+ }
+}
+add_action('rss2_item', 'cf_media_rss_links');
+
+?>

0 comments on commit dbd2f77

Please sign in to comment.