Search code examples
wordpressrssfeedw3c-validation

how to clear blank lines before the start of feed content for wordpress?


Our site has a category feed URL and it is giving an an error if tried to generate a SimpleXMLElement.

http://www.e4s.co.uk/blogs/employers/category/articles/feed/

I validated the URL at http://validator.w3.org/appc/ and it is showing that blank lines at the beginning is the issue.

How can I remove the blank lines. I mean in which file do i need to change ?


Solution

  • To remove the white space, look at your theme's header.php and remove any white space you see at the top of the file. It should ideally only contain <?php on the first line of the document and no white space between the closing ?> and your DOCTYPE declaration, e.g.

    <?php
    /**
     * header.php
     */
    ?><!DOCTYPE html>
    
    <!-- rest of file... -->
    


    Looking at a content page on your site, I see there's no closing </body> or </html> which leads me to believe that your template is missing a get_footer(); call or footer.php is incomplete.