Fork me on GitHub

article

WordCamp Denver, 2009. My humble experience.

March 2, 2009 | PHP Scripting

Amazingly enough I had the opportunity to speak at WordCamp Denver. As nervous as I was before hand (I very well could have puked) I came out pumped. Hopefully a few others did as well.

Say what?

My talk was about the basics of WordPress plugin development: actions and filters. The amount of ground I had to cover was akin to having 10lbs. of shit in a 5lb. bag. In retrospect I could have cut one part of the plugin short to leave myself time to cover the other bases at a bit more of a leisurely pace, but in reality what I needed was about 2 more hours to have time to discuss what I was doing and why. Hopefully, though, the amount of ground covered in a short amount of time was a decent illustration of just how quickly one can develop for WordPress. While its not the optimal system (don’t take that the wrong way, nothing is optimal in the blogging space right now) WordPress makes changing the system very straight forward.

The responses vary from WTF? all the way around Thank You! I’m not too worried about the variances in responses because at events like this there will be the advanced programmers who view an introductory presentation and then blog about how basic it was and then there will be those that didn’t understand anything and feel the need to say it was way too complex. Fortunately most of the responses I’ve dealt with have been in the middle. I even had a long talk with one of the attendees immediately following my presentation about everything from OOP & MVC programming approaches, why WordPress can’t do that right now, and even a little bit about operating system choices to another attendee who stopped in on the conversation.

All in all: I want to do it again. And I hope I have the chance to.

The demo plugin

The demo plugin I chose to build was a Featured Post plugin. The goal was simple: create a plugin that adds a meta box to the post-edit admin screen so that I could record the post’s status as being featured and then differentiate the post on the wordpress front end. I also wanted to show a list of featured posts in the sidebar as well as at the bottom of each post. And to do it all without touching the WordPress core or a theme file.

For those that are interested, the plugin source can be viewed here. That source is heavily commented to help anyone learn from the file. If there’s anything I left out I’d be glad to add more information, and if there’s demand I could write up a post here that details the creation of the plugin even more. Just let me know. That script can also be downloaded along with my presentation slides (in PDF format) by going here (that is the same page linked to from the WordCamp schedule page).

For anyone who wants to go for the full effect, here is the image I used as a badge and the CSS used to place it:

image

  1.  /* BASIC STYLING */
  2.  span.mfp-featured {
  3.   display: none;
  4.  }
  5.  .post span.mfp-featured {
  6.   display: inline;
  7.  }
  8.  #mfp-featured-posts-list-inline li span.mfp-featured {
  9.   display: none;
  10.  }
  11.  /* BADGE STYLING */
  12.  span.mfp-featured {
  13.   display: none;
  14.  }
  15.  .post span.mfp-featured {
  16.   display: block;
  17.   width: 75px;
  18.   height: 75px;
  19.   background: transparent url('images/starburst-omg-white.png') 0 0 no-repeat;
  20.   text-indent: -9999px;
  21.   position: absolute;
  22.   left: -80px;
  23.   top: -20px;
  24.  }
  25.  #mfp-featured-posts-list-inline li {
  26.   margin-bottom: 2px;
  27.   margin-left: 20px;
  28.  }
  29.  .post h2 {
  30.   position: relative;
  31.   text-align: left;
  32.  }

Extras

To compliment the talk I’ve put together a Tag Cloud of the WordPress actions and filters from WordPress 1.5 to present. It is a first revision and has just some basic styling and functionality, but covers all the bases. I can see this turning in to a larger deconstruction of the WordPress core so we’ll just have to see what kind of time I have to put in to it. This all by itself is pretty durned handy and I know I’ll be referencing it quite a bit. I just like mousing around and watching the pop-ups too 😉 It has been tested in Firefox and Safari. I haven’t even gandered at it in IE and probably never will.

There is one filter in there that’s not completely right. If anyone can point it out before I fix it I’ll buy ya cup of coffee.

Not yet extra

There was another document that I brought up on screen that was requested by someone in the audience. I haven’t had time to make sure that its at least 95% accurate so I’m holding on to that one until I have the chance to properly edit it and I’d also like to do it for WordPress 2.7. The one I brought up was done for WordPress 2.6.

Fin

So, thanks if you’ve gotten through this far and I hope to be throwing more WordPress knowledge out soon. Maybe first, though, I should actually get this heap on to WordPress so that I can use it as a functional example as well. This back end code, though light and efficient, doesn’t have any built in conveniences.

3 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  • Shawn, thanks very much for the presentation and for making the resources available. Informative and inspiring!

    -Adam

    Adam, March 3, 2009 9:18 am | permalink

  • The link to your slides is broken.

    misuba, September 18, 2009 1:19 pm | permalink

  • Thanks! I forgot to migrate a .htaccess rule when doing an update. It works now.

    Shawn, September 18, 2009 1:40 pm | permalink

Comments are closed