tags:

views:

294

answers:

2

I'm running a wordpress blog and would like to access the actual file that creates the feed. Unfortunately when I do that it throws up a lot of errors because it's using a lot of functions.

My current best idea is to make a duplicate file that doesn't need those functions or has them hard coded in but I want to get a 2nd opinion on this.

I'm running WP2.7.

+2  A: 

Moving the files in a single file is the obvious solution. The question is why do you need the file in the first place?

If all you want is to easily extract the the posts from the DB and format them in an RSS feed you can give up on WP completely and do it all with a file with less than 30 lines of code.

Roy.

Roy Peleg
Yours is the better solution but mine the faster. I'll happily accept your answer as the better one.
Teifion
+1  A: 

Solution found.

  • Find the file "wp-includes/feed-rss2.php" (swap for whatever feed you want to use)
  • Create a 2nd version of the file so that you don't overwrite any WP stuff and then open said file.
  • Add the following code before any other code is executed

    if (file_exists('../wp-blog-header.php')) require('../wp-blog-header.php');
    elseif (file_exists('blog/wp-blog-header.php')) require('blog/wp-blog-header.php');
    //The second line is needed if you are including this file from somewhere else

This solution is faster to put into effect than RoyPel's one but not as good.

Teifion