
Earlier today, I finished up a WordPress plugin that I’ve been working on for a client. Without divulging too many details, I’ll say that it wasn’t a huge project, nor was it overly complicated, but it was interesting. One fun thing about working on projects for clients, is that it often gives you a chance to explore areas that you might not have looked too closely at on your own.
For example, some of the areas of WordPress (and PHP in general) that I researched and learned more about were:
- The WordPress Settings API
- The WP Cron scheduling system
- Using the WP_Http class to communicate with a third-party web service
- Using the
wp_upload_bits()function to create an image file - Learning some of the newer bits that were added to
wp_insert_post()since I originally created it as part of my XML-RPC API work over 6 years ago - PHP’s SimpleXML functions (including some specifics around using
xpath()with namespaced elements)
I used a combination of the links above, other articles I found, plus some good old exploration in the WordPress core to learn more about these topics. Exploring the core code was most helpful in learning about WP_Http, wp_upload_bits(), and some extras for wp_insert_post() that aren’t documented on the Codex page.
Digging around in these corners of the code can be much like spelunking. You’re digging down into places never seen by most people, and often finding little gems that you suspected might exist, but you weren’t sure until you actually saw them. If you haven’t poked around in the core code lately, maybe you should. I usually prefer to use command-line tools like grep and a text editor. But the online WordPress phpdoc xref is a nice way to look at the code, too.
ack > grep
grep kills small animals.
ack kills and eats them.
For straight speed coding, generally I use a text editor with a global directory search built into it. TextPad on Windows, for example.
When doing more involved PHP development, I use an IDE. I’ve been liking Eclipse with PDT lately. Very handy to be able to point at a function call, press a button, and have the IDE take you straight to that function, even in another file. Far less typing and searching that way.
Otto, I’ve been using Aptana Studio, which is built on Eclipse.
I have a love/hate relationship with Eclipse, going back at least 10 years. Aptana seems to configure everything about how I like. v2 has the PDT built in, looking forward to checking it out (more spelunking).
Also, I ran across your blog a month or so ago. Very nice. On my hit list for digging around in.
Nice.
I’ve been caving off and on since 1977. Totally agree that poking around in code is like caving.
Need to do a little WP code exploration myself.
A weekend spelunker myself, I couldn’t agree more, and i’m loving WP just as much!
What is the plugin used for? Your mind is intuitive judging from the “… often finding little gems that you suspected might exist, but you weren’t sure until you actually saw them.“. I always enjoy when such matters happen to me, like a wake up call sometimes. A new one for me: spelunking.
I can’t divulge details of the plugin right now. For one thing, it’s not quite finished yet (I have to make some enhancements/fixes based on feedback from the initial review). Plus, it’s work for a client, and though I’m not technically under NDA, they own the code by contract, so I’d rather have their blessing before discussing it.
And while I understand curiosity about what the plugin might be for, it was really just a backdrop to the main point of my post, which is that working on someone else’s project often leads you to explore interesting areas that you might not have looked at otherwise.
While this particular project lead to me to investigate the things I mentioned above, other projects have similarly lead me to other areas. For example, I could have talked about a project that had me digging deep into the WordPress eXtended RSS (WXR) export file format and parsing HTML using phpQuery. Or a non-WordPress project that had me creating a lightweight MVC PHP backend, with a jQuery frontend, and AJAX in-between (plus a lot of RSS parsing with SimplePie).
It’s not the specifics of this particular project that are important. The important part is that it lead me to once again step out of my comfort zone, expand my horizons a little bit, and learn something new.
Using many of the same pieces you’ve mentioned here, so could guess at the type of project. Thanks for bringing some new functions to my attention too.
Regarding the XML-RPC, would you recommend using this as a mechanism for secure data delivery to paying customers? Can’t think of a better person to ask.
XML-RPC has no inherent security. You’d want to make sure your endpoint uses SSL.
Thank you sir! Have a million more questions, but it’s good to know that you take on projects for clients.
I like very much your last sentence (in your reply to my comment.) I surely rely to that too. And if it’s a unique/custom work for a valued client then the privacy can be expected…
I don’t think “apt-get install ack” is the same ack talked about above is it? Man page says it’s a “Kanji code converter”, nothing to do with grep or killing animals!
The package they’re talking about is named “ack-grep”. I made the same mistake
Thank you! Just installed it and will give it a go!
BTW – I clicked the comments link from the “new comment” email and didn’t see your reply. I had to reload the page. Unfortunately I don’t know if the page was cached by Chromium or your server but I had closed the page after I left the comment yesterday.