There was a bit of anticipation around my talk on the WordPress Endpoint API at last week’s OCWP Dev Meetup. Ben, one of our buddies from Seattle could scarcely contain his excitement.
To be totally honest, the Endpoint API was one that I hadn’t fully grasped the power of until the post by Jon Cave (a.k.a duck_) went up on Make WordPress Plugins. I spent the afternoon coding up a little demo of how the API could be used, which I turned into a plugin. If you’re just looking for the code, you can find it on github. The plugin creates a custom post type called ocwp-members, with one pre-defined custom field for a member’s blog link. It then adds an endpoint to that post type that redirects the visitor to the member’s blog. It adds some neat click tracking pulled from AdSanity and a link to the endpoint in the post content through the the_content filter. It’s a simple plugin, but demonstrates a few neat things you can do with the api. You can find Jon’s article here and more WordPress awesomeness at Make WordPress.org in the link in Jason’s tweet below. If you have a copy of “Professional WordPress Plugin Development”, written by Brad Williams, Ozh Richard and Justin Tadlock, you can check out pages 417-421 for more information and code samples.There was a problem connecting to Twitter.
To get the full explanation of what the code does, check out the video below.
When I set out to build the plugin demo, I wanted to try a new dev tool (plugin) that Otto talked about about on WP Late Night (if you don’t listen to this WP Candy podcast, you really should) a few weeks back. The plugin, appropriately named Pluginception, creates and activates new, empty plugins with the click of a button. As Stephen pointed out, it is a plugin to quickly deploy working code via small recyclable plugins.There was a problem connecting to Twitter.
I mentioned it in the video, but thought the warning deserved a mention in print as well:
DO NOT USE THIS IN PRODUCTION. YOU’VE BEEN WARNED.There was a problem connecting to Twitter.
Have you used WordPress Rewrite Endpoints? If so, what did you do with them? If not, does this give you any ideas where you could use them?