How can I get RSS feed for a custom page?

You can create your own feeds in wordpress.

Add this to functions.php:

function my_customfeed() {
load_template( TEMPLATEPATH . 'your-customfeed.php');
}
add_action('do_feed_customfeed', 'my_customfeed', 10, 1);

This will enable a new feed called customfeed.

Now you can create your-customfeed.php in your theme directory for the new rss.
To make things easier you can copy the rss2 wordpress template from /wp-includes/feed-rss2.php and adapt with the code of your custom page.

Then you can call your new feed with http://yoursite.com/?feed=customfeed.

customfeed can be any unique name you like, just make sure to replace in all these places, including the action name do_feed_customfeed.

ANOTHER METHOD (doesn’t need to add code in functions.php)

A easier way to do it is to create a template for the feed like this:

<?php
/*
Template Name: My Custom Feed
*/

$posts = query_posts(array('post_type' => 'project', 'posts_per_page' => get_wizy('portfolio_num_projects')));

include('wp-includes/feed-rss2.php');
?>

And then create a blank Page in wordpress (it could be named anything, like My custom feed) and in the sidebar choose the template you created (it has the same name has it is written in Template Name:..).

Now when you go to the url of the page you’ve just created, you have your feed.

Leave a Comment

tech