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

main_feed.php :

Download main_feed.php


<?php
/* Main feed */
$last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';
make_cacheable($last_modified, 60*60*8);/* make cacheable in browsers for 8 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="UTF-8"?>'; global $more; $more = 0; ?>

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	<?php do_action('rss2_ns'); ?>
>
	<channel>
		<title><?php bloginfo_rss('name'); wp_title_rss(' - '); ?></title>
		<atom:link href="http://<?php echo $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI']; ?>" rel="self" type="application/rss+xml" />
		<link><?php bloginfo_rss('url'); echo $_SERVER['REQUEST_URI']; ?></link>
		<description><?php bloginfo_rss("description") ?></description>
		<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
		
		<language>en</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
		<?php do_action('rss2_head'); ?>

		<image>
			<url>http://media.example.com/logo.png</url>
			<title><?php bloginfo_rss('name'); wp_title_rss(' - '); ?></title>
			<link><?php bloginfo_rss('url'); echo $_SERVER['REQUEST_URI']; ?></link>
			<width>50</width>
			<height>50</height>
			<description><?php bloginfo_rss("description") ?></description>
		</image>
		<?php while( have_posts()) : the_post(); ?>

		<item>
			<title><?php the_title_rss() ?></title>
			<link><?php the_permalink_rss() ?></link>
			<comments><?php comments_link(); ?></comments>
			<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
			<dc:creator><?php the_author() ?></dc:creator>
			<?php the_category_rss() ?>
			<guid isPermaLink="false"><?php the_guid(); ?></guid>
<?php if (get_option('rss_use_excerpt')) : ?>
			<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
<?php else : ?>
			<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
	<?php if ( strlen( $post->post_content ) > 0 ) : ?>
		<content:encoded><![CDATA[<?php the_content('') ?><p>Read the article "<a href="<?php the_permalink_rss() ?>"><?php the_title_rss() ?></a>" on <?php bloginfo_rss('name') ?></p>]]></content:encoded>
	<?php else : ?>
		<content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></content:encoded>
	<?php endif; ?>
<?php endif; ?>
		<wfw:commentRss><?php echo feed_url(get_permalink()); ?></wfw:commentRss>
<?php rss_enclosure(); ?>
		<?php do_action('rss2_item'); ?></item>
	<?php endwhile; ?></channel>
</rss>

1 2 3