Viewing 4 replies - 16 through 19 (of 19 total)
  • Thread Starter bramme

    (@bramme)

    It seems I have finally uncovered the problem.

    To create my blog’s theme, I downloaded a blank sandbox theme (I believe from wpcandy.com) and used that.

    Just now, I tried moving my site to another host and see what that gave. When trying to login I suddenly got a “headers already sent” error which pointed to my theme/functions.php directory. When I looked at that, I saw the following:

    <?php
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '<h4>',
    'after_title' => '</h4>',
    ));
    ?>
    
    <?php // for sidebar.php if needed (remove the // below the if() statement) ?>
    <?php // if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : endif; ?>

    Removing second to last line, causing the problems: apparently, simply putting a php comment, also counts as whitespace…

    Deleting those 2 last lines solved all my problems.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    No, having that blank line between the PHP bits counts as whitespace.

    'after_title' => '</h4>',
    ));
    ?>
    (SEE ME? I'M WHITESPACE!)
    <?php // for sidebar.php if nee

    A theme’s functions.php file must start with <?php and end with ?> and not create any output in between.

    I would just like to say thanks to pshoeg for pointing us to the answer to this riddle.

    We tried every other cure we could find, but his suggestion of using the php file at https://wejn.org/stuff/wejnswpwhitespacefix.php.html worked for us.

    All credit to the author of the code too for working out a solution.

    I suspect his code will help many others with this same problem as it’s a generic solution that should cover white line faults in code from third party template vendors.

    We used the .htaccess method from the page mentioned in case anyone is interested.

    How did you install pshoeg php file? I tried and couldn’t get it to work.

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Blank line added in feed, causing feed not to work’ is closed to new replies.