WordPress is a large application. According to Westi’s XREF of trunk, WordPress defines 188 classes, 3840 functions, and 302 constants (since the xref counts variables of all scopes, I’m not including them here). For comparison, depending on your version of PHP, there are anywhere from 2-4 thousand native functions in the language. With so many functions, WordPress is bound to have some really cool ones floating around; and unless you either read core or are active on trac and/or #wordpress-dev, you might not have seen these before.
So I am currently converting a Drupal site to WordPress, and one of the features I had to build was ajax powered pagination. Now, WordPress does pagination pretty effectively already, but the ajax is all up to the theme developer.
Fortunately, I’d built the theme using WP 3.0′s new
get_template_part() functionality to include one loop in all template pages. I didn’t realize how helpful that would be at the time, but I want to share it with you now. I develop themes and plugins using OOP 1, but I’ve only included the relevant parts. Also, the loop file is wrapped in a div with an id of
content_container in the template files.
- Object Oriented Programming ↩
You’re probably looking for some code about custom permalinks. Don’t. Just don’t. I’ve taken it down. Look on some other website.