Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've read all the articles about creating a custom RSS feed, but haven't had any luck - always results in a blank page. To make things simple, here is the code I'm using - with the link being www.mysite.com?feed=fb2

Note, this has worked on some servers (meaning there is no blank page, and the RSS works), but not on others with no apparent logic to explain why. Can anybody see what might be going on?

function rssmi_feed() {
  get_my_feed();
}
add_action('init', 'rssmi_rss');

function rssmi_rss(){
  add_feed('fb2', 'rssmi_feed');
}
function get_my_feed(){
  header("Content-Type: application/rss+xml; charset=UTF-8");
  echo '<?xml version="1.0"?>';
  $output = '<rss version="2.0">';
  $output .= '<channel>';
  $output .= '<title>Your RSS Feed Name or Website Name</title>';
  $output .= '<description>A description of your feed or site.</description>';
  $output .= '<link>http://www.yoursite.com/</link>';
  $output .= '<copyright>Your copyright details</copyright>';
  $output .= '<item>';      
  $output .= '<title>Some Title</title>';   
  $output .= '<link>Some Link</link>';
  $output .= '<description>A description</description>';
  $output .= '<pubdate>The date</pubdate>';
  $output .= '<guid>The Link</guid>';
  $output .= '</item>';
  $output .= '</channel></rss>';
  echo($output);
}
share|improve this question
1  
Please add debug information to your question to make answers possible. –  toscho May 4 '13 at 21:17
    
Is there a working URL? –  s_ha_dum May 4 '13 at 21:28
    
it's actually on a development server...I changed it so debug=true, but I still get a blank page. I'll put the program on a production server and provide a link in a few minutes (although it will be blank). –  Allen May 4 '13 at 23:35
    
wprssimporter.com?feed=allenfeed –  Allen May 4 '13 at 23:37
    
also, the link above has a different slug (allenfeed instead of fb2) but the program is exactly the same (with just a different slug) –  Allen May 4 '13 at 23:51
add comment

1 Answer 1

Invalid Feed template message sometimes due to having a page or post with same name. Wordpress doesn't handle attributes with overlapping names (reused names) well.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.