Hi,
Here is a piece of code to point to your own feed template and create an unique feed name.
function create_my_customfeed() {
load_template( TEMPLATEPATH . 'your-custom-feed.php'); // You'll create a your-custom-feed.php file in your theme's directory
}
add_action('do_feed_customfeed', 'create_my_customfeed', 10, 1);
Now, you will need to modify your feed. You will now be able to access your feed at http://yoursite.com/?feed=customfeed. But what about how WordPress does the really neat rewriting of feeds from /?feed=rss to /feed/rss/? That requires using generate_rewrite_rules(), as described in the WP_Rewrite Codex page.
http://codex.wordpress.org/Function_Reference/WP_Rewrite
This piece of code will allow you to have any feed name, and dynamically “create” /customfeed.xml as well as a /feed/customfeed/ versions:
function custom_feed_rewrite($wp_rewrite) {
$feed_rules = array(
'feed/(.+)' => 'index.php?feed=' . $wp_rewrite->preg_index(1),
'(.+).xml' => 'index.php?feed='. $wp_rewrite->preg_index(1)
);
$wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
}
add_filter('generate_rewrite_rules', 'custom_feed_rewrite');
In the first piece of code, we told the create_my_customfeed() function to look in your theme’s directory for a your-custom-feed.php file. This will be the feed template your feed will use.
Thanks,
Shane G.