WordPress.org

Forums

Functions.php adding weird top space on theme (10 posts)

  1. rafaelveiga
    Member
    Posted 1 year ago #

    I'm developing a theme. When the file 'functions.php' exists on the theme folder, it creates a space on the top portion of the website just above header, breaking the entire theme. When I delete or rename 'functions.php', everything goes back to normal.

    I've checked all the margins and paddings from all the divs around this area, all the blank spaces and blank lines in the code and disabled the administration bar, but it seems that I can't find where this is spacing is coming from.

    Here is the screenshot, with functions.php: http://i41.tinypic.com/3bkph.jpg

    Why this is happening? How do I solve this problem? How do I remove this space?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    You obviously have a problem in your theme's function.php file somewhere.

  3. rafaelveiga
    Member
    Posted 1 year ago #

    Here is my function file:

    <?php
    function excerpt_ellipse($text) {
       return str_replace('[...]', '<div class="readmore"> <a href="'.get_permalink().'">Read more...</a></div>', $text); }
    add_filter('the_excerpt', 'excerpt_ellipse');
    ?>

    And that's it.

    It's just a script to replace the [...] from the excerpt with a Read More link

  4. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    And what happens if you have a completely blank functions.php file?

  5. rafaelveiga
    Member
    Posted 1 year ago #

    The space still remains

  6. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    Try creating a new blank functions.php file.

  7. rafaelveiga
    Member
    Posted 1 year ago #

    It doesn't change anything, the space still remains when there is a functions.php (blank) file in the folder

  8. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    What are you using to create this blank functions,php file?

  9. rafaelveiga
    Member
    Posted 1 year ago #

    I was using Adobe Dreamweaver CS4. I've created another totally blank functions.php file via notepad and the problem apparently is solved.

    I've already re-inserted my code on my new functions.php file and it's now working, the space is gone.

    Can you tell me what was going on with Dreamweaver? Why there is that space when the file is created via Dreamweaver?

    Thanks for the help!

  10. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    Sounds like Dreamweaver is inserting invisible characters at the top of the file.

Topic Closed

This topic has been closed to new replies.

About this Topic