How to Move Your WordPress Feeds to a Sub-domain - Page 3

comment_feed.php :

Download comment_feed.php


<?php
/* Comment feed */
$last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0).' GMT';
make_cacheable($last_modified, 60*60*3);/* make cacheable in browsers for 3 hours & send 'Not modified' (304) header if not modified. */
header('Content-Type: text/xml;charset=' . get_option('blog_charset'), true);
echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
	<channel>
		<title><?php echo 'Comments : ', get_wp_title_rss(''), ' - ', get_bloginfo( 'name' );?></title>
		<atom:link href="http://<?php echo $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI']; ?>" rel="self" type="application/rss+xml" />
		<link><?php the_permalink_rss(); ?></link>
		<description><?php the_excerpt_rss(); ?></description>
		<pubDate><?php echo gmdate('r'); ?></pubDate>

		<sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
		<sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>
		<image>
			<url>http://media.example.com/logo.png</url>
			<title><?php echo 'Comments : ', get_wp_title_rss(''), ' - ', get_bloginfo( 'name' );?></title>
			<link><?php the_permalink_rss(); ?></link>
			<width>50</width>
			<height>50</height>
			<description><?php the_excerpt_rss(); ?></description>
		</image>	
		<?php do_action('commentsrss2_head');
		$q = "SELECT comment_ID, comment_author, comment_date_gmt, comment_content FROM $wpdb->comments WHERE comment_post_ID = $post->ID AND comment_approved = 1 ORDER BY comment_date DESC LIMIT 10";
		$comments = $wpdb->get_results($q);
		foreach($comments as $comment) 
		{ $comment->comment_ID; $date = mysql2date('D, d M Y H:i:s +0000', $comment->comment_date_gmt); ?>

		<item>
			<title><?php echo $comment->comment_author; ?></title>
			<link><?php trailingslashit(the_permalink_rss()); ?>#comments</link>
			<pubDate><?php echo $date; ?></pubDate>
			<dc:creator><?php echo $comment->comment_author; ?></dc:creator>
			<guid isPermaLink="false"><?php trailingslashit(the_permalink_rss()); ?>#comment-<?php echo $comment->comment_ID; ?></guid>
			<description><![CDATA[<?php echo strip_tags(substr($comment->comment_content, 0, 40)); ?>]]></description>
			<content:encoded><![CDATA[<?php echo $comment->comment_content; ?>]]></content:encoded>
		</item>
<?php	} ?>

	</channel>
</rss>

1 2 3

Or get RSS feed

Author: Syam Kumar R

Syam Kumar is an independent Web Developer based in Cochin, India. His interests include information design concepts, standards compliant web development and Linux. He administers WebMaster View.

This entry was posted on Wednesday, December 2nd, 2009 at 1:27 am and modified by webmasterview on Thursday, March 4th, 2010 at 5:09 pm. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Comments : 4

  1. MOrning mr Syam!

    I want to thank you for this great webpage it has helped me alot and i don have to have as many sleepless nights!

    Thanx and i have now bookmarked this page!

    Vuxenleksaker

  2. I was searching for this and got it here.. great share

    amandkumar

  3. Thank you so much for sharing this. This is a really great source which can improve websites. Thanks again!

    Video Avatar

  4. Very useful function. I was searching it for long time. Thanks

    cherthala friends

Pings/Trackbacks: 6

  1. Setup a separate sub-domain for media files in WordPress - WebMaster View
  2. Tweets that mention How to Move Your WordPress Feeds to a Sub-domain - WebMaster View -- Topsy.com
  3. How to Move Your WordPress Feeds to a Sub-domain - Domain Blog
  4. ajf7688 Blog - How to Move Your WordPress Feeds to a Sub-domain – WebMaster View
  5. How to Move Your WordPress Feeds to a Sub-domain – WebMaster View
  6. wp-popular.com » Blog Archive » How to Move Your WordPress Feeds to a Sub-domain – Page 2 – WebMaster View

RSS feed

follow

Be a Fan

Bad Behavior has blocked 1299 access attempts in the last 7 days.