WordPress Ajax API Example

This plugin is no longer maintained; however, you can still view the source on GitHub.

As a developer, one of the challenges of working with WordPress as a platform is that finding information isn’t always easy. Sure, the Codex is a fantastic resource, but it lacks in a few areas.

On the other hand, it’s relatively easy to google for examples on how to do almost anything you’d like with WordPress, but these examples can often be of poor quality – just because something works doesn’t mean that it’s done correctly.

As I begin to shift my focus to talking more about WordPress development, I hope to be able to share a few thoughts on how to achieve certain tasks using the best practices with the WordPress API.

In recent weeks, I’ve been doing a fair amount of work using the WordPress Ajax API, so that seemed like a good place to start.

Continue reading “WordPress Ajax API Example”

PHPUnit, WordPress, and MAMP

I’ve begun using PHPUnit, WordPress, and MAMP to introduce unit testing to my theme and plugin development. Obviously, this requires an installation of PHPUnit and the WordPress testing framework. Because I use MAMP for local development, I had to do some additional customization to get the frameworks setup.

Here are the steps necessary to install PHPUnit and the WordPress Tests on Mac OS X using MAMP:

Continue reading “PHPUnit, WordPress, and MAMP”

Create a WordPress Upload Meta Box

This post was updated on March 22, 2013. Please review the code changes below.

WordPress makes it pretty easy to capture additional information with your posts through the use of custom meta boxes. Adding checkboxes, select options, textareas, radio buttons, and other input elements are easy.

But giving users the ability to upload files from a post screen requires a little more work.

If you’re not interested in tapping into the Media Uploader, then here’s how you can programmatically create a WordPress upload meta box.

Continue reading “Create a WordPress Upload Meta Box”