Search Results
Block-level comments trick
Block-level comments are useful for commenting out an entire block of code in PHP, CSS, and other code contexts.
/* $this = 'code is deactivated'; $and = 'so is this'; */
The only problem with this is that when you go to re-activate this code, you have to change both the opening and closing comment markers. That’s a pain.
While I was at WordCamp NYC last week, I saw Daisy Olsen using a very clever trick in her lightning round talk.
/* $this = 'code is deactivated'; $and = 'so is this'; /**/
See what she did there? The closing comment marker is preceded by another opening marker. Because comment blocks can’t be nested, this second opening comment marker is ignored. This enabled her to re-enable this code by removing the opening marker.
$this = 'code is reactivated'; $and = 'so is this'; /**/
Brilliant! I can’t believe I haven’t seen this before. The one downside to this is that you are deleting two characters and destroying the opening marker. Here’s an even better method.
//* $this = 'code is reactivated'; $and = 'so is this'; /**/
By adding a slash in front of the opening comment marker, I comment out the comment marker. It only takes one key press, and the corpse of the original opening marker is retained, allowing you to reinstate it with the deletion of a single character.
Props to Aleem Bawany for the second trick (he uses //*/ as the closing comment, which works pretty much the same way).
What other commenting tricks do you know?
8 steps to get started as a freelance WordPress developer
I’ve had a bunch of people ask me how they could get started as a WordPress developer or consultant. Rather than answer them all individually and privately, I’m putting it up for all to see.
Become involved with the development community
Join the wp-hackers mailing list. Participate when you have something useful to say, or an interesting question/problem to pose to other WP developers. Dive in at the WP support forums. Find someone with an interesting problem, and solve it for them. If it’s a notable issue, write a blog post about how to solve the issue. Which brings me to the next task…
Blog about WordPress
I’m doing this right now! Not only is it deliciously “meta,” it can raise your profile and help you connect with other WordPress developers and users. Write about a problem you solved, or a challenge you’d like to see addressed by WordPress core or a WordPress plugin. And don’t forget to blog about the plugins you write…
Write a bunch of useful plugins
This is probably the best thing you can do to get noticed by clients. Write a useful plugin and you’ll be getting business leads for years to come. You don’t have to write a really big, complicated plugin. Write something that will make using WordPress easier, more fun, more efficient, and people will remember you. It might be good to have one more ambitious plugin to serve as an example of your skills, but certainly don’t shy away from brevity. Some of the favorite things I’ve written are between 1 and 50 lines of code. Users don’t care about how big a plugin is. They just want it to serve a need. Go ahead and scratch their itch. Hint: monitor Google or Twitter for people saying “I want a WordPress plugin…” to get an idea of the sorts of needs that are currently unfulfilled.
Contribute to WordPress core
Contributing to the WordPress core software helps you in two ways. First, it provides continuing education. WordPress is constantly evolving, and you need to stay sharp! This is a great way to learn about (and influence) the direction of the WordPress codebase. Second, it raises your profile in the WordPress community (both the developer and user communities). Be sure to blog about your WordPress core contributions. Trac is a great place to start. Maintain a calm demeanor, and don’t get too big for your britches. Don’t be the person who comes in and embarrasses themselves by closing a ticket as “WONTFIX” that was opened by a seasoned developer! Watch how other tickets evolve and you’ll figure out how it works.
Stay in contact with more seasoned developers
A lot of us are busy, but we try to make time to mentor people. We’re all well-served by a vibrant development marketplace. Don’t be afraid to contact a more experienced developer for advice. The worst that will happen is that you’ll get ignored — apologies to anyone who is in my e-mail limbo… resend it if it’s been more than a few weeks!
And as you get more experienced:
Speak at WordCamps and other events
Once you’ve gained enough kudos in the WP community, you’ll likely be asked to talk at a WordCamp event. And if you haven’t, and you think you could bring something special to the event, go ahead and ask if they need any more speakers! This will raise your profile further, introduce you to really cool people, and provide you with a bunch of business leads. BarCamps, social media gatherings, and other such events are also worth attending. The point isn’t to get up there and give a business pitch. In fact, your life might be in danger if you pull that stunt at a BarCamp. The point is to impart knowledge, connect with people, while letting your skills expose themselves naturally. And pitch away when you’re chatting up potential leads between sessions.
Charge according to your skill set and experience
Several years ago, I had the quasi-embarrassing surprise of being given a voluntary 75% per-hour raise by a client. I think they were afraid that my skills had outpaced my rate, and that I was going to get wooed away by a new client at a higher rate. Don’t make the mistake of charging too little. In fact, publish higher rates than you actually think you’re worth, and allow people to haggle you down (a little). And every time you get booked up and have to turn away business, raise your rate. If you’re in that much demand, you’re not charging enough.
Find a niche
But not WordPress security. That’s mine.
A WordPress development niche is a niche within a niche. And that means you can charge more for your more specialized skills. Examples: migrating data to WordPress. Feed kung-fu. Re-implementing a design from another system. Custom write-panel plugins. Sidebar widgets.
State of the Word – WordCamp Mid-Atlantic
Here are my slides from the State of the Word keynote at WordCamp Mid-Atlantic:
BarCamp/WordCamp Miami

I’ll be in Miami on Sunday, February 22nd for BarCamp/WordCamp Miami. If you’re in the area or are in town for the Future of Web Apps conference, you should stop by!
What should I talk about?
Update: There has been a venue change for this event, so if you were planning on going, make sure you take note of the new location!
Slides from WordPress keynote at WordCamp Charlotte
Here are the slides from my keynote talk at WordCamp Charlotte.
Upcoming events I’ll be attending
Here’s a list of upcoming blogging/WordPress/tech events that I’m planning on attending:
- Blog Orlando – September 27th
This event has been a bunch of fun the last two years — wouldn’t miss it. I’ll be speaking on “Advanced WordPress” - WordCamp Toronto – October 4th and 5th
Will be attending, and may be speaking too. - BarCamp Tampa Bay – October 11th and 12th
The tech/blogging community in Tampa has recently started to get more organized, and this should be a good way of meeting more of the local people. - WordCamp Charlotte – November 15th
I’ll be giving the keynote presentation at this WordCamp event.
Hope to see you at one of those events! And if you’re in New York City, be sure to check out WordCamp New York, on October 5th (hey, there’s a testament to WordPress’ gaining popularity — there are two WordPress camps on the same day!)
U.S. Government Agencies Using WordPress
Here is a list (probably not all-inclusive) of United States government agencies or organizations using WordPress (whether privately or publicly):
- Air Force
- Army
- Central Intelligence Agency (CIA)
- Coast Guard
- Defense Intelligence Agency
- Department of Energy
- Department of Homeland Security
- Department of State
- Department of Treasury
- Drug Enforcement Agency (DEA)
- Marine Corps
- Federal Bureau of Investigation (FBI)
- National Geospatial Intelligence Agency
- National Reconnaissance Agency
- National Security Agency (NSA)
- Navy
This list was revealed at WordCamp San Francisco, 2008.
Secure Coding with WordPress – WordCamp SF 2008 Slides
Here are the slides from my Secure Coding with WordPress presentation at WordCamp SF 2008:
The Comment Inbox
I’ve been whiteboarding a new WordPress comment management interface for about a year now — since before the Happy Cog admin redesign started. I had some lofty goals (admittedly some of them were borderline unachievable), but my main goal was this: make comment management more like managing a Gmail inbox. There are typically four actions you can perform on a message in your Gmail inbox (other than reading it, that is): reply, archive, mark as spam, delete. And “reply” is sort of diversion, so let’s make that three actions: archive, mark as spam, delete. The great thing is that if you do it right, at the end, you’re left with an empty inbox, and you know all your open loops have been addressed. It’s a good feeling, and it lets you know that the next time you dive into your inbox, you’re starting where you left off.
With WordPress comment management, it was more like jumping on a passing train of infinite length, and trying to deal with all of the passengers on board, without knowing which passengers have been dealt with (do you walk towards the caboose or the engine!?). When you’re done, you jump off, land on a cactus, and probably don’t feel like doing it again.
So my goal was to move away from the infinite train of confusion and more to the zen-like GTD tranquility of the Gmail inbox. Liz Danzico from Happy Cog alluded to a similar goal at WordCamp SF 2007. Although the Happy Cog redesign of the comment management screens is worlds better, it didn’t fundamentally address the speeding train issue. And to be honest, I’ve been stuck on the problem for months. I couldn’t think of an implementation that wouldn’t be a massively disruptive (and risky) overhaul… until tonight — kept awake by SXSW-inflicted cough and sore throat that refuse to die, I had my epiphany. The solution is already here. I’ve been searching for something that WordPress already does.
Drumroll please. The solution is: the comment moderation panel. Full stop.
I’ve noticed that Matt Mullenweg hasn’t quite been as dissatisfied with comment management as I have, and there’s a simple reason: he approves every comment that appears on his blog, whereas I deal with the comments after the fact.
Now I know what you’re thinking… but what if I don’t want to have to approve comments before they appear on my blog? Simple: tweak your blog to publicly show unapproved comments! Now there are three comment statuses in WordPress: approved (1), unapproved (0), and spam. With my proposed system those can be virtually “rethought” as: seen (1), unseen (0) and spam. Both “seen” and “unseen” comments would show on the blog immediately, but “unseen” comments would show up in the moderation queue (which, thanks to the Happy Cog redesign, shows its contents in a colorful comment bubble on every WordPress admin page). Welcome to your comment inbox. There are three types of comments: ham (good comments), spam (advertisements), and bacn (offtopic, lame, rude, abusive, overly-self-promotional-but-not-quite-spam), and there are three corresponding actions: archive (by clicking the “approve” link), mark as spam, delete — just like in Gmail.
I’m going to write a plugin that does this as soon as I can, but I’m also going to be looking for a way to work this into WordPress core, as I think it would really help people manage their comment load.
So what do you think? Is this brilliant? Am I completely off my rocker? Am I an idiot for not seeing this solution before now?
Update: Here’s the plugin!
“Getting Involved with WordPress” session video
John Pozadzides has posted the video of the session that I did with Lloyd Budd at WordCamp 2007 on “Getting Involved with WordPress.” Thanks John! And yes — you summed up the spirit of the session well: you don’t have to be a programmer to get involved with WordPress!
“Contributing to WordPress” Slides from WordCamp
Here are the slides from my “Contributing to WordPress” presentation at WordCamp 2007.
Want to work with me at b5media?
The company I work for, b5media, is hiring. In particular interest to the sort of people who likely read this blog are the following open positions:
- Server Ninja — If you know how to scale and administer a LAMP stack, we have a ninja suit for you (yes, it does protect you from UV rays). The ideal candidate is based in Toronto, but other locations in Canada or the Eastern Seaboard in the States are also options.
- Junior Tech Support — This is a Toronto-based position. 25% of the time you’ll be doing IT duties in our Toronoto office (printers, networking, Windows troubleshooting, etc), 25% of the time you’ll be taking care of support issues for the ad team (placing ads, etc), and the other 50% of the time you’ll be taking care of blogger support. This is a “jack of all trades” position. You don’t need to be a WordPress Ninja (like me), but you do need to be familiar with the platform and be able to diagnose basic issues with PHP/WordPress. HTML/CSS/JS knowlege is a must, especially familiarity with techniques for solving issues related to those technologies. You’ll also need good friendly communication skills.
- WordPress Developer — Ninja-level or near-ninja-level WordPress skills will qualify you for this job. You’ll be writing plugins, integrating WordPress with other systems, solving WordPress core and plugin bugs and passing the fixes up the ladder, scaling the application and helping mentor/assist our tech support person (see above). Plus I get to call you “mini-me” for the first three months. This position is not geographically restricted (that I know of).
Talk to Aaron Brazell (my immediate supervisor… not my boss — private joke) if you’re interested in one of these technical positions.
Hello Dolly Bug
It just now occurred to me that at WordCamp I joked that the happiest moment of my life was when I found a bug in “Hello Dolly,” the ultra-simple example plugin that has been bundled with WordPress for as long as I can remember. Correction: I committed the fix for the bug, but I wasn’t the one who found the bug. Chalk that down to fuzzy memory. In any case, that’s why we track these things. Here is the now legendary commit, and here is the report. Sorry for accidentally taking credit for that, “joti!”
Note the time difference between the report and the fix. Thirteen minutes. Nothing but the best for our precious Dolly!
The bug existed because numerically indexed arrays start at 0, not 1. So the number of the last element in an array is actually one less than the number of elements in that array.
WordCamp 2007
I’ll be at WordCamp in San Francisco on July 21st and 22nd. I’m actually going to be arriving in San Francisco on the 17th. I’m taking advantage of the company-sponsored flight to take a little time off. My wife Sarah will be joining me for the duration of my stay. We don’t have any definite plans for the 17th through the 20th, but we’ll likely do some touristy stuff and catch up with some friends in the area. If you live in SF or are going to be arriving a few days early for WordCamp, drop me a line and maybe we can meet up! I definitely want to see the folks from Automattic and maybe get some WordPress brainstorming done before the conference!
I’ll be participating in two sessions at WordCamp — one on each day. The first day is oriented towards non-technical topics, and the second is more focused on developer topics.
At 3pm on Saturday, I’ll be doing Getting Involved with WordPress with Automattic’s Lloyd Budd. Lloyd will be covering the more general topics of why you might want to contribute to the project (and how you might already be doing so!) and I’ll be diving into the details a bit more as well as sharing what I’ve learned about the WordPress community and development process over the last three years.
On Sunday at 4:30pm I’ll be participating in the Developer Duke-out session along with Matt Mullenweg, Ryan Boren, Andy Skelton et al (probably anyone on the “about” page who happens to be there). I actually have no idea what we’re doing in this session, but if I had to guess, I’d imagine we’d be talking about the future of WordPress development as well as fielding a lot of questions from the audience.
The lineup of speakers is really great this year. I’m particularly looking forward to the sessions by Matt Cuts, Robert Hoekman, Jr., Rashmi Sinha, and Liz Danzico.
Hope to see you there!
BlogOrlando
I’m going to be at the BlogOrlando conference unconference on September 22nd at Rollins College in Orlando, FL. I’ll be leading the “Tools” session with Andrew Odom. Andrew is also a WordPress user, so rest easy: WordPress will be mentioned.
I know it’s short notice, but if there are any WordPress bloggers within driving distance of Orlando, you should sign up and come say hi to me. It’s free! I know someone at WordCamp was talking to me about BlogOrlando, so whoever you are, I guess I’ll see you there!

