• Resolved micasuh

    (@micasuh)


    When I click on view source, every page has an extra line break before the doctype!

    I’ve deactivated all plugins. Doesn’t help.
    I’ve selectively deleted code. Doesn’t help.
    I’ve switched to a completely different theme all together. No top line break in source code.
    I’ve deleted CSS and JS file code. Doesn’t help.

    Is this a problem with my template or is it something deeper?

Viewing 4 replies - 1 through 4 (of 4 total)
  • “I’ve switched to a completely different theme all together. No top line break in source code.”

    I saw it happen once with an advanced theme which included some theme options at top of header.php. What theme are you using or Site URL?

    Thread Starter micasuh

    (@micasuh)

    Well, I resolved my problem!

    What I did not know and could not find any information about is that it’s not good to have any spaces in functions.php. I’ve seen talk about this with other people but it wasn’t specific.

    If there is any space between php requests, that can break the feed since somehow it inserts a space in the templates after rendering.

    For example, if you have several php requests that are opened and closed, they should be right next to each other. Such as this:

    <?php foo ?>
    <?php foo ?>

    If it looks like this:

    <?php foo ?>
    [extra line break here]
    <?php foo ?>

    it’ll break because of the extra line break in the middle of the php requests.

    So always put php requests right next to each other. Your theme and feed will thank you!

    Good for you and thanks for sharing your solution.

    Thanks micasuh.

    I was having the same issue with mysterious white space above the doctype. This fixed it.

    It also seems to have fixed an issue I was having with not being able to edit widgets in the admin area.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘remove space from top of source code’ is closed to new replies.