Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've a strange problem with an Autofocus theme.

In my templates file, header.php, I've a code like this (and is correct)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

When I look at the source code of the generated HTML, I found something like this

[blank]
[blank]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

The extra blank lines are breaking my RSS feeds...

Other info:

  • No filters on the content except wpautop
  • functions.php doesn't do anything on the content
  • Plugins All In One Seo, WP Stats, Smiley Remover, SEO Friendly images

Any clues?

share|improve this question
2  
I'll go out on a limb and say this is a plugin. After taking a look at the theme, it doesn't do anything before the doctype tag is printed. Plugins are loaded before Themes, so jjeaton's answer is the right course of action. –  Jeff Sebring Jul 28 '11 at 5:00
add comment

2 Answers

up vote 3 down vote accepted

the_content doesn't affect the DOCTYPE and <html> tags, only the post/page content.

One of your plugins, or something else in the theme is either throwing an error, or is printing something earlier than it should.

Have you tried:

  • Disabling each plugin one by one and see when it is fixed.
  • Editing wp-config.php and adding define( 'WP_DEBUG', true ); to look for errors
share|improve this answer
    
Got it! But not one plugin, but 4 plugins. That was the first time for me! I suspect a mix of outdated wp and plugins... upgraded everything. But you got it right! +1 –  keatch Aug 10 '11 at 9:56
    
@keatch glad I was able to help! –  jjeaton Aug 10 '11 at 17:32
add comment

I believe the problem is that there are not any <?php opening tags in your header.php so the space is probably coming from your templates that call <?php get_header(); ?>

Try adding a commented out header like so:

<?php
/**
 * The Header for our theme.
 *
 * Displays all of the <head> section 
 *
 */
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

It's also possible that you have windows line endings which sometimes get parsed as a dbl line ending adding an extra space to each line.

share|improve this answer
    
Partially right, but that was not the case. –  keatch Aug 10 '11 at 9:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.