WP 2.1 Include File Reorganization

During the 2.1 development cycle, we've been tidying up our includes. They had gotten rather messy, with a bazillion functions being piled into the functions.php catch-all. Go take a look at trunk and see how things have changed. functions.php is much slimmer, and we have a few more files. We tried to separate the presentation from the backend logic a little better. For example, comment functions that perform DB operations go in comment.php. Comment functions that spit out markup go in comment-template.php. Pretty straightforward. All of the "big query" and "post loop" related functions are gathered in query.php. Rewrite functions are in rewrite.php, plugin functions are in plugin.php, and so on. This is nothing that end-users care about, but I feel cleaner. 🙂

12 thoughts on “WP 2.1 Include File Reorganization

  1. THANK! U! 4! THIS! 😀

    Due to my longtime use of the SMF-Boardware i´m used to clear structured and cleaned up sources, so that the WP-Sources seemed very chaotic to me, which made modding a very, erm, uneasy job 🙄

    Keep up the good work!

    best regards


  2. It would be great to see some more documentation within the WP-files. What about using phpdoc-compatible comments like

    * function name does blahblah
    * @return: int
    * @….

    This should be a great relief for anyone programming Plugins.

  3. Is the reorg over? The function reference at RedAlt goes wonky every time you guys move something. Pain in my butt. 🙂

  4. Owen, I’m thinking about moving the options/settings functions into a separate file. What do you think? Leave comments on #2525 if there’s anything you want or don’t want reorged.

  5. No worries. The reorg is good.

    When a function moves from one file to another, the function reference (which is automated) sees a function disappear from one file and a new function with the same name pop up elsewhere. It doesn’t have the intelligence to correlate the loss of one to the gain of the other, so I have to occasionally tweak them all manually. With all of the recent reorg, I wrote a script to automate that part, too, but I need to run that interactively whenever functions move. No big.

    Moving those options functions sounds like a good idea to me, anyway.

Leave a Reply