Smarter WordPress Comment Status

just-huhI love WordPress more and more with each release, and 2.7 takes the cake; I’ve never been a happier designer, developer or user of a CMS/blogging platform. As awesome as it is 95% of the time,  I did encounter a setback when developing this site’s theme, specifically in the behavior of comment links.

One of the goals of my site redesign was to open up opportunities for conversation, and journal comments are a significant part of that. As such, I wanted the links to the left of the journal items to behave in the following way:

  • If comments are open, always display a link to them or to the comment form.
  • If comments are closed, but the post has comments (presumably made before the closure), display the link.
  • If comments are closed, and the post has no comments, there isn’t any reason to maintain the link; don’t show it at all.
I wanted to customize the style and destination of the comment link a bit more than the usual comments_popup_link function would allow. I took some cues from the default theme and referenced $post->comment_status, resulting in the following conditional:

if (get_comments_number() || 'open' == $post->comment_status)  {
    Comment stuff...

Unfortunately, this had one flaw; any posts where the comments were closed as a result of WordPress’ “automatically close comments after x number of days” setting retained the comments link no matter what. While $post->comment_status appeared to work correctly in comments.php, elsewhere it would still return 'open' for those posts which had not been implicitly closed.

My solution was to create a function in my theme’s functions.php file called showCommentLink, which  checks the number of comments, post status and the automatic closure preference before returning a boolean (true for show, false for hide). Take a look:

function showCommentsLink($num,$status,$date) {
// If number of comments is zero, check some other stuff
if ($num <= 0) {
    // If comment status is not open, return false
    if ($status != 'open') {
        return false;
    // If comment status is open, check if automatic closure is enabled
    $close = get_option('close_comments_for_old_posts');
    // If so, grab the number of days and compare
    if ($close) {
        $days = get_option('close_comments_days_old');
        $cutoff = strtotime("-$days days");
        $then = strtotime($date);
        // If this post's comment status is "expired," return false
        if ($then < $cutoff) {
            return false;
// If you've made it this far, return true
return true;

And sample usage in The Loop:

if (showCommentsLink(get_comments_number(),$post->comment_status,$post->post_date))  {
    // Comment stuff...

While definitely not the prettiest solution in the world, it appears to do the trick. Having $post->comment_status behave differently in different contexts seems like either an oversight on the part of WordPress developers or, potentially more likely, a sign that I am doing something a bit backwards.

What’s your take? See something I’m doing wrong or have a way to improve the function? Want to see me port it to a plugin for more streamlined use in The Loop? Think all this WordPress stuff is a waste of time when I could use Drupal instead? Let me know in the comments!

The iPhone and Oz

You know that scene in Wizard of Oz when Dorothy opens her monochromatic door to a world of vivid color? That’s the feeling I had the first day I ditched my non-descript, run-of-the-mill cell phone for a shiny, happy iPhone. (That being said, I do believe the hoard of singing dwarves that followed me home was a wholly unrelated occurrence. The monkeys could be connected, though.)

Before you begin either praising or cursing my seemingly gargantuan amount of Apple fanaticism, bare in mind that I could have experienced the same feeling had I chosen a Blackberry Storm, Android G1 or Palm Treo Pro; it is the connectivity above all else that has made me such a happy camper. So why did I choose the iPhone, specifically?

  • The interface appealed to me, an obvious extension of lessons learned on the Palm OS, Mac OS X and, of course, the iPod. Plus, it is hawt.
  • iTunes integration. As flawed as the application may be, it’s been my go-to media library for almost 5 years.
  • As a designer/developer, I can’t ignore the rich, vibrant community of like-minded creators populating the vast App Store with thousands of mobile tools, games and experiments. I wanted to experience that, and possibly become a part of it.
After about a week and a half of use, I’m still enamored with this little device. The ability to have constant access to one’s email, task list, Twitter feed and general online presence is infectious. Case-in-point: This entire post was written on the iPhone using the excellent (and delightfully free) WordPress application.

That being said, there are just a few minor annoyances I’ve encountered:

  • There’s built-in Gmail, Google Search and Google Maps, syncing with Google Contacts, but no Google Calendar? Seriously?
  • Mobile Safari appears to have set a new standard for portable browsing, but since it’s the only app that has crashed on me, I’d love to give alternatives (Opera Mini) a try. Loosen the leash a bit, Apple.
  • Dropbox and Air Sharing are excellent 3rd-party file management tools, but it seems silly that I can’t store things on the iPhone’s filesystem like I can an iPod Classic. Is it just to discourage hacking?
I’m sure I’ll have plenty more positive and negative comments with continued use, or until a product of equal or greater polish (Palm Pre?) comes along for comparison. Until then, it appears my luddite days are over as I finally drink the Apple kool-aid.

“I want to go home,” I said as I tapped my home button (unnecessarily) four times.

(The WordPress app appends attached images to the bottom of the article. I’ve included screenshots of my wallpaper, featuring one of my mother’s Yellowstone photographs, and the 2nd page of my applications menu, simply because it’s less defaulty than the first..)

MAD’s going quarterly (What, Me Worry?)

Alfred and II was saddened to hear today that after years of sagging sales, MAD Magazine is going quarterly (and all spin-off titles are getting the axe). While Peanuts was my first love in comics, MAD was assuredly my second. It was satirical but not pretentious, naughty but not malicious. With cartoonists as amazing as Sergio Aragonés, Antonio Prohias, Don Martin, Al Jaffee, Jack Davis, Harvey Kurtzman, Mort Drucker and many more represented therein, MAD ensured itself a dedicated section of my bookshelf that exists to this day.

That being said, the change is understandable and more than a little expected. With the exception of a year or so in high school, I’ve never been a subscriber. I was introduced to MAD through my dad, who enjoyed both the magazine and pocket books as a kid, and encouraged by my mom, who tolerated many quests through used book stores searching for volumes which lay undiscovered. While modern films were being parodied in it’s pages, I was reading older back-issues from the book’s heyday. As great as many of the contemporary artists are, they’ve always felt foreign next to my yellowed, dog-eared copies of Captain Klutz, and parodies of Harry Potter have always seemed less like a private joke between the artist and I than did old satires of the Godfather series, Star Trek and MAS*H.

The more obvious issue is that of online competition. In an age of Pitchfork Media and IGN, it seems absolutely comical that I ever paid for copies of SPIN and Game Informer. I still believe that MAD offers a level of quality cartooning largely unparalleled on the web, but sites like YouTube are overflowing with the sort of irreverence and subversiveness that was once the source of MAD’s immediate appeal.

Mark Evanier is right when he says that the brand and personality of MAD are still too valuable to die quietly. While there are a plethora of well-written comics online, very few of them are also well-drawn. If MAD could capture the web’s attention while maintaining the standard of cartooning readers have enjoyed for over 50 years, we’d be the “gang of idiots” for not reading.

The Future of Mobile Devices is Now

I find myself in awe of the staggering potential of mobile devices. A little over a week ago, Palm introduced us to the upcoming WebOS, and yesterday I finally ditched my crappy cell phone for an iPhone.

Compared to my previous phone, the iPhone is a revelation. The ability to access my phone, email, contacts, calendar, task manager and more in a handheld device is a uniquely fuzzy feeling. The unity and polish of the UI has, aside from a couple minor complaints, been an absolute joy to set up and use.

Somewhat counter-intuitively, owning and using the iPhone has only amplified my anticipation and excitement for the Palm Pre. If you haven’t seen it yet, treat yourself to a look:

Many have been calling the WebOS a spiritual successor to the iPhone interface, and I can see why. It takes the polish, minimalism and versatility of Apple’s design and adds a cohesiveness wherein applications co-exist in some fashion beyond the home screen.

Seeing as the iPhone ditched a traditional keypad in favor of an entirely touch-based approach, Palm’s addition of a slide-out keyboard and “gesture area” may seem like a step backward. I disagree, as I’m reminded of a similar decision made with the original Treo and described by industrial designer Dennis Boyle in Bill Moggridge’s book Designing Interactions. Therein, he explains the incentive for ditching the innovative, gesture-based “Graffiti” method of entering text:

Handspring TreoI remember that Handspring decided to put the Treo out with both a keyboard and Graffiti, because they didn’t know which one people would choose; they decided to let them vote. The result was quite clear; a large majority went for the small keyboard. […] [The] little QWERTY keyboard, bad as it is, is such a standard that it requires no guesswork, and that attracts more users.
While the comparison isn’t perfect (the only real difference between a touch and traditional keyboard is tactility), the lesson is clear: designers shouldn’t dismiss ubiquitous methods of text entry any more than they should ignore canonical visual language in iconography design.

I still believe we may be surprised by the future impact of Google’s Android (in terms of sheer number of potential applications) , but the iPhone and, potentially, the Palm Pre will assuredly establish a level of polish and immediacy that other vendors will continue to reach for and, hopefully, surpass.

If you find yourself losing your passion for interaction design or The Web, try out one of these devices. The realization that a versatile, dynamic connection to ourselves and the world will rest attractively in the palms of our hands will ignite your enthusiasm faster than almost anything.

Google’s Favicon Redesigned

On Friday, Google debuted it’s second favicon redesign in the last year and I, along with many other users, am somewhat befuddled by it.

Criticizing Google’s logo is usually a cheap shot. The reason Google gets away with less-than-amazing visual design is because their user experiences are so outstanding. We don’t care that Google Docs and Gmail have less visual flourishes than Word 2007 and Windows Live Hotmail because the interface is more precisely and consistently tuned to our needs. The more obstacles you put in the user’s path, the more important it is to distract them with shiny objects; Google is great at alleviating obstacles.


A “favicon” is a 16 square-pixel image that represents a web page, typically displayed in the browser’s address bar and tabs. Google stuck with the same yawn-inducing yet unoffensive favicon up till May 2008, when it was replaced with an even more milquetoast but still unoffensive lower-case “g” on a light-gray gradient. The switch to a lower-case “g” made sense, as the shape was more distinctive and added an allusion to the concept of “infinity,” and thusly it’s close relative “googol” (the really high number from which Google’s name is derived phonetically). The lower-case “g” was used again for Google’s mobile iPhone app, perhaps most successfully due to the contrast of a white “g” on vibrant blue.


I’m talking about the new icon because it’s the first I’ve experienced that is visually distracting. The lack of counter space between the complimentary red and green hues results in a visual tension that, while initially more eye-catching than previous designs, ultimately results in an abrasive visual strain compounded for every browser tab.

I completely understand Google’s desire to incorporate their logo’s colors into the icon in order to strengthen an already recognizable and trusted identity. But in this case, I believe the icon’s uncomfortable contrast goes against their otherwise smooth-as-silk experiences.


I’ve created a replacement icon which retains the new composition, combined with the colors and dimension of their iPhone icon. While I haven’t incorporated all four of their colors into one image, the icon is more spiritually consistent with the rest of Google’s experience.

You can use it yourself by installing this simple Greasemonkey script.

What are your thoughts regarding Google’s favicon? Am I off the mark? Do you care?

Update: It looks like Brand New agrees, calling the new icon “terrible”.