• Resolved flight1307

    (@flight1307)


    Is it correct that not closing the code block with ‘functions.php’ is correct practice? i.e.

    <?php
    
    all your functions file code ...

    instead of:

    <?php
    
    all your functions file code ...
    
    ?>

    The reason I ask is because leaving the code block UNclosed is the only thing that stops my site page/s and WordPress login page from breaking or turning into blank pages. Thank you in advance.

    IFlight

Viewing 3 replies - 1 through 3 (of 3 total)
  • Is it correct that not closing the code block with ‘functions.php’ is correct practice?

    Not closing the end of the file with ?> is considered by some (including myself) to be best practice because:

    1. The closing ?> is superfluous given that PHP will close when the file closes

    2. It reduces the potential for “headers already sent” errors.

    Does that help.

    Thread Starter flight1307

    (@flight1307)

    Yes, thank you. It does help. I’ve been following this tutorial:

    http://blog.teamtreehouse.com/responsive-wordpress-bootstrap-theme-tutorial

    and it’s all working correctly now. It’s much easier to work with Bootstrap alone. When you associate Bootstrap with WordPress, things break and go weird a lot. I don’t want to just drag in a bunch of plugins. I want to understand the coding issues. So it’s good to get a few fundamental mysteries answered, and this has been one. Thank you, Esmi.

    No problem. Glad I could help 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘'functions.php' question’ is closed to new replies.