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 comments to WP 2.1 Include File Reorganization

  1. Daniel Petry says:

    Yeah, it seems cleaner.. Much more organized, if compared with other versions…
    Very nice! ;)

  2. dandyna says:

    Good work, guys!!!

  3. mao-b says:

    THANK! U! 4! THIS! :-D

    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 :roll:

    Keep up the good work!

    best regards

    M

  4. 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.

  5. [...] WordPress 2.1 Include File Reorganization Ryan Boren, from Automattic, is working on WordPress, and has recently mentioned a major shift in how include files are going to be in 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. [...]

  6. Trevor Turk says:

    Would this result is a speed bump, or is it just for peace of mind?

  7. Blok.NOT says:

    Verry vell, boys! We are waiting…

  8. Owen says:

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

  9. Ryan says:

    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.

  10. Owen says:

    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.

  11. [...] The new version looks pretty good right now. You can checkout the latest revision of WordPress 2.1-alpha2 from the SVN repository. The main noticiable new feature is the Bookmarks handling system (previously known as the Links Manager). Now, bookmarks are all managed through just like independant categories (they will be using the same table in the DB) with the links categorized neatly. This also makes it possible to have multiple categories per bookmark, which is a good thing, although I’m not really sure what the point of that was. I just got my copy of 2.1-aplha2 so I still have to figure out what are its other uses. There is also a feature for a custom front page rather than being forced to show the latest entries, which is something smart and useful. I havn’t really noticed any improved spam handling, I was really hoping they integrate a wordfilter into this one by default, but it looks like I will have to stick with my plugin for now. I havn’t discovered all of the features as yet, but I don’t think there are many others than the ones I mentioned above and some improvements in the back-end coding. I’ll fiddle with it a bit later and compile my list of bugs for the hunt on Wednesday. Let me leave you with some screenshots. [...]

  12. Jobs says:

    Interesting work guys. I’m gonna love it. Need upgrade from current version 2.0.2 :(