my wordpress theme

August 14th, 2006

So it turns out that adding custom fields in WordPress is really easy. Just use the Custom Fields box beneath the input box and add a new field. This new field will be presented as an option for every new post as well (this I would not be brave enough to assume, but it's so). From there on, bringing back Now Playing is really simple, so I thought why not just make it a plugin while I'm at it.

Using the plugin requires this as part of the post in the template: <?php get_now_playing($post); ?>. Yes, it requires passing on the $post object and no I don't know why. Why do *you* care? :P

So since I made it a plugin anyway, I thought I might as well package it up on the very slight off chance that someone would want it for themselves.

And while we're at it, I packed up the theme I'm using as well, get both of them below. The reason I bundle this is that the theme illustrates how to use the plugin. Not only where to call the function, but also how to style it, you'll find that at the bottom of style.css.

One caveat, the plugin *expects* a custom field called Now Playing, nothing more, nothing less. So if you neglect to include the whitespace or you call it something else, you'll have to hack the plugin to make it work (which is trivial, just edit the call to get_post_meta and you're done).

"How about a demo", you say. Look at the bottom of this post. :)

:: random entries in this category ::

2 Responses to "my wordpress theme"

  1. Nawaf says:

    woohoo! :D
    Wish I was a 1337 h4x0r like you to do this sort of things.. :D

  2. erik says:

    I wouldn't pursue that, Nawaf. He's in his own little dimension of which we get to see a small part but we can never enter :D