Hi all -- I'm tweaking an existing wordpress theme to suit my needs (with little or no html, css or php experience -- yikes), but I'm really trying to give each of my issues an honest go before I post here for help. I don't want to abuse these forums! That having been said:
My RSS feeds for both posts and comments appear to be broken, and clicking on the "subscribe" returns this error message:
XML Parsing Error: XML or text declaration not at start of entity Location: http://www.blogosaur.com/?feed=comments-rss2 Line Number 3, Column 1: <?xml version="1.0" encoding="UTF-8"?><rss version="2.0" ^
I thought it would lead me to an rss file that I could start poking around in, but all the rss-related php files in my blogosaur.com/ directory are just redirects, and I cant figure out where they're redirecting to (they look like this:)
<?php /** * Redirects to the RSS2 feed * This file is deprecated and only exists for backwards compatibility * * @package WordPress */
Anybody have any insight to get this working? The weird thing is, I switched the theme this morning to see if that would fix the problem (it has with some other stuff, giving me clues on where to start hunting for answers) and the RSS feeds worked briefly! They kept working when I switched back for a short period, then stopped again. Repeating my theme-switching tactic failed to repeat this result. A hallucination, perhaps?
It looks like the file that's giving me trouble is my feed.rss2.php file in my wp-includes directory. I think? But the theoretically offensive lines of code read
as displayed in my error message. I've tried messing around with it to no avail (not surprising since all of my tweaking is pure speculative experimentation), and also pasting in a supposedly curative code snippet that I found here: http://www.w3it.org/blog/wordpress-feed ... on-how-to/
No progress yet. My research leads me to believe that the problem could be extra spaces in my code somewhere (which is what the solution at the link tries to fix). Anybody have any insight?
No, that actually helps a lot! According to the validator I've got a spare line at the beginning of my feed, but I have no idea how it's getting there. I've been going over my rss-related php files, my wp-config file and my functions.php file, but haven't found anything that seems to be helping.
The feeds still work in google reader, it turns out, and probably some others. But I know I need to get rid of that extra line if I want to be rid or the error message when you click on my rss feed button.
I have a vague recollection of reading somewhere else that your problem could be plugin related. Try disabling your plugins one by one, each time checking your feed.
Thanks, I actually tried disabling all plugins, and I'm still in the same boat with the rss feeds. It seems to be theme-independent now, so something in one of my rss2 or config files or somewhere is adding that extra line. I'm still looking for it.
The only thing I can think of now, and you're gonna hate me for this, is a clean install.
It sounds like you've been messing about with some of the core files, maybe try replacing just the files you have been working on.
Otherwise, backup your posts, do a clean install check the rss works, activate your theme, check again, activate your plugins, check again, import your backed up posts, check again etc.
Yeah, I think I'm going to have to try that at some point -- it's not the posts I'm worried about, because this is a pre-launch site that I'm building from the ground up. It's all the tweaking I've done on the theme so far.
Another thought -- when I view the source code of my main page, it has that extra line at the top, just like my feed does. I can't find it in my header or page templates -- surely this is a symptom of my overall problem.
I just tried switching to the default theme, and now my rss feed validates -- my confusion on this before stems from the fact that the feed apparently doesn't update until I add a new post, so I was still getting the error when I switched themes, and thinking the problem wasn't fixed. What I needed to do was validate the theme instead. Also, in the default theme that spare line is gone from my main page source code.
So it's definitely something in my theme throwing that extra line up. I think this theme was broken when I got it.
Provided there is no space before or after that code, then I stand corrected.
Then the only other thing I can think of that is specific to a theme that might affect it is the header.php. Compare that to the header.php in the default theme, is there anything obviously different?
Well, my header.php file doesn't have a <?php /* theme name */ ?>line like the default, but adding one doesn't help. I checked several themes, and some have it, some don't.
The first line in my header is
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
and yet in my source code for the page, there's an extra, blank line above this (which goes away when I switch themes). I guess wordpress uses pretty much all of the php files in my themes folder to generate page code, but what would stick a blank line at the very to of my pages, and at the top of my rss code?
I appreciate, by the way, all your insight to which straws I should try grasping at. :)
I'm just not sure where -- but replacing my functions file with the default theme one fixes the problem (both in the feed and the page code) of course it screws my sidebar all up.
So I have no extra spaces before of after this in my file -- does this file call information from other places that could be screwing it up? Iget the following errors when I try to validate it:
# Line 4, Column 28: character \"(\" not allowed in prolog
'before_widget' => (<ul class=\"category-bg\">),
# Error Line 5, Column 27: character \"'\" not allowed in prolog
'after_widget' => '</ul>',
# Error Line 6, Column 27: character \"'\" not allowed in prolog
'before_title' => '<h2>',
# Error Line 7, Column 26: character \"'\" not allowed in prolog
'after_title' => '</h2>',
# Error Line 9, Column 3: end of document in prolog
Aren't those apostrophes supposed to be there, though? Or is the apostrophe the crux of the biscuit> :shock:
Thanks for all your help on this, man. The first thing I did was search for similar fixes, and tried a couple that didn't work -- I should post links to that on all the pages where I found other people struggling with this same thing!
My RSS feeds for both posts and comments appear to be broken, and clicking on the "subscribe" returns this error message:
XML Parsing Error: XML or text declaration not at start of entity
Location: http://www.blogosaur.com/?feed=comments-rss2
Line Number 3, Column 1:
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
^
I thought it would lead me to an rss file that I could start poking around in, but all the rss-related php files in my blogosaur.com/ directory are just redirects, and I cant figure out where they're redirecting to (they look like this:)
Anybody have any insight to get this working? The weird thing is, I switched the theme this morning to see if that would fix the problem (it has with some other stuff, giving me clues on where to start hunting for answers) and the RSS feeds worked briefly! They kept working when I switched back for a short period, then stopped again. Repeating my theme-switching tactic failed to repeat this result. A hallucination, perhaps?
Site is at: http://www.blogosaur.com/
It looks like the file that's giving me trouble is my feed.rss2.php file in my wp-includes directory. I think? But the theoretically offensive lines of code read
echo '<?xml version=\"1.0\" encoding=\"'.get_option('blog_charset').'\"?'.'>';
?>
<rss version=\"2.0\"
rather than
as displayed in my error message. I've tried messing around with it to no avail (not surprising since all of my tweaking is pure speculative experimentation), and also pasting in a supposedly curative code snippet that I found here: http://www.w3it.org/blog/wordpress-feed ... on-how-to/
No progress yet. My research leads me to believe that the problem could be extra spaces in my code somewhere (which is what the solution at the link tries to fix). Anybody have any insight?
The feeds still work in google reader, it turns out, and probably some others. But I know I need to get rid of that extra line if I want to be rid or the error message when you click on my rss feed button.
It sounds like you've been messing about with some of the core files, maybe try replacing just the files you have been working on.
Otherwise, backup your posts, do a clean install check the rss works, activate your theme, check again, activate your plugins, check again, import your backed up posts, check again etc.
Another thought -- when I view the source code of my main page, it has that extra line at the top, just like my feed does. I can't find it in my header or page templates -- surely this is a symptom of my overall problem.
I just tried switching to the default theme, and now my rss feed validates -- my confusion on this before stems from the fact that the feed apparently doesn't update until I add a new post, so I was still getting the error when I switched themes, and thinking the problem wasn't fixed. What I needed to do was validate the theme instead. Also, in the default theme that spare line is gone from my main page source code.
So it's definitely something in my theme throwing that extra line up. I think this theme was broken when I got it.
Then the only other thing I can think of that is specific to a theme that might affect it is the header.php. Compare that to the header.php in the default theme, is there anything obviously different?
I'm clutching at straws here. Can you tell? :D
The first line in my header is
and yet in my source code for the page, there's an extra, blank line above this (which goes away when I switch themes). I guess wordpress uses pretty much all of the php files in my themes folder to generate page code, but what would stick a blank line at the very to of my pages, and at the top of my rss code?
I appreciate, by the way, all your insight to which straws I should try grasping at. :)
Just found this http://stiern.com/tutorials/no-more-invalid-rss
I'm just not sure where -- but replacing my functions file with the default theme one fixes the problem (both in the feed and the page code) of course it screws my sidebar all up.
So I have no extra spaces before of after this in my file -- does this file call information from other places that could be screwing it up? Iget the following errors when I try to validate it:
Aren't those apostrophes supposed to be there, though? Or is the apostrophe the crux of the biscuit> :shock:
Thanks for all your help on this, man. The first thing I did was search for similar fixes, and tried a couple that didn't work -- I should post links to that on all the pages where I found other people struggling with this same thing!
You're welcome. Glad we got there in the end.
I can go to bed now. :)