Support » Fixing WordPress » wp-rss2.php screwed up

  • 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').\"?".">"; ?>

Viewing 8 replies - 1 through 8 (of 8 total)
  • 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').'"?'.'>'; ?>

    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.

    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.

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

    Here’s the validator link:
    http://tinyurl.com/q2wwa

    Here’s the whole block:
    `
    <?php

    if (empty($wp)) {
    require_once('wp-config.php');
    wp('feed=rss2');
    }

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

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

    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.

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

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

    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!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘wp-rss2.php screwed up’ is closed to new replies.