• 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)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

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

    Thread Starter jeremyrosen

    (@jeremyrosen)

    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.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    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.

    Thread Starter jeremyrosen

    (@jeremyrosen)

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

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    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.

    Thread Starter jeremyrosen

    (@jeremyrosen)

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

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

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

    Thread Starter jeremyrosen

    (@jeremyrosen)

    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.