wp-rss2.php screwed up (9 posts)

  1. JeremyRosen
    Posted 9 years ago #

    I was fixing one thing to make my feed valid and seem to have somehow screwed up another. I've narrowed down the problem to one line of PHP, but have no idea what the proper syntax is. Could someone help me out here?

    <?php echo "<?xml version=\"1.0\" encoding=\"UTF-8\" . get_settings('blog_charset').\"?".">"; ?>

  2. I'm not sure what exactly you're trying to do there, including the utf-8 manually. That's what the blog_charset does. Here's the correct line for a feed:

    <?php echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; ?>

  3. JeremyRosen
    Posted 9 years ago #

    Thanks Otto. I'm not sure what happened there, I think it was just a bad copy and paste. I put the above in, which solved the one problem, but when I run it through the feed validator, it tells me there's something wrong with the comma before .get_settings.

  4. Umm.. yeah.. I looked at your feed, and that's clearly not right. Here's what's in the feed:

    <?xml version="1.0" encoding="'.get_settings('blog_charset').'"?>

    Look closer at the line I originally posted above. See how it says:
    ...echo '...

    That's a SINGLE quote. Try just copy and pasting my line over your own instead of modifying yours to match. Might make things simpler.

  5. JeremyRosen
    Posted 9 years ago #

    Yeah, I did just copy and paste it in there, so I'm not sure what's going on.

    Here's the validator link:

    Here's the whole block:

    if (empty($wp)) {

    header('Content-type: text/xml; charset=' . get_settings('blog_charset'), true);
    $more = 1;

    <?php echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; ?>

  6. I don't know what the deal is then, because validator is also saying that the content type and charset are wrong. It's like your header line isn't getting executed either.

    My suggestion is to redownload the wordpress package and replace wp-rss2.php with the default. Then make your changes as needed.

  7. JeremyRosen
    Posted 9 years ago #

    Hrm. Just did that and now the feed's completely borked.

  8. Jeremy: Huh? The feed now looks fine to me. Feed Validator is mostly happy with it too.

  9. JeremyRosen
    Posted 9 years ago #

    Yeah, I have absolutely no clue. I don't like it when things fix themselves, but I'm not complaining. Thanks for your help, regardless!

Topic Closed

This topic has been closed to new replies.

About this Topic