The Top 5 Uses for WordPress Custom Fields
If you use WordPress, I’m sure you’ve noticed the “Custom Fields” option you get when writing a post. For the vast majority of bloggers, this incredibly usefull, and versatile piece of functionality goes unused. At the moment you may be thinking that the reason you don’t use it, is that you have no use for it. This may very well be true but, its also likely that no one has really explained what’s possible. So, to give you a gentle push in the right direction, I’ve got the five best uses for WordPress Custom Fields. And at the end of this post, I’ll provide some links to resources on using these fields in your template.
- The same information with every post – This very much follows the example found on the WordPress Codex entry for Custom Fields. The idea is simple, if you usually put the same information, for example your location, a task you’re completing, on every post, you can use a custom field. The advantage of using a custom field to do this is that the information is displayed consistently on every post and, if you’re clever enough, you could do different things based on these values. If you just put this information in the main post content, it tends to get lost and it would be a pain to maintain. This is really the basis for custom fields, so we’ll expand on the sort of information you may want to use consistently across posts.
- Images – Yes, you can put images into posts but using a custom field for an image allows you to do new and interesting things with them. One of the most common uses is having a thumbnail for each post. Thumbnails are only slightly usefull when viewing the whole post but come into their own when you are viewing the home page, or category page of a site. An example is the Premium News WordPress Theme which uses custom fields to hold the images that accompany the stories on the front page. You can probably see the implementation more clearly on the Kineda inspired version. Disclaimer: I don’t know for sure whether the designers use custom fields to acheive this, but I would be surprised if they didn’t.
- Files – There are blogs out there that attach files to blog posts. An example is the rather excellent PSDTuts site, which runs some really high quality Photoshop Tutorials. With each post they attach the PSD file (Photoshop file format) for download (and recently, purchase). Looking at the way this is handled, I would imagine this is through custom fields.
- Change Styles – The previous examples have all been to do with displaying information to the user or making something available. There is something else you can do though, and that’s attach a value to the post that changes it’s style. For example, if you wanted to make any posts you make about Christmas look more, er, Christmassy, you could output a value which styled the post accordingly. It would be fairly simple to set up and you could leave the rest of your posts completely untouched.
- Copy Functionality – Functionality is available on other blogging platforms that you can’t find in WordPress. Fortunately, the custom field options allow you to duplicate much of this. To give a specific example, blogs run by Weblogs Inc use a custom blogging platform called Blogsmith. If you take a look at one of their most popular blogs, Engadget, you will see that they provide a link at the bottom of each post that points to the source. This differs from many other blogs that include a link to the source within the body of the post. Want to do something similar, and make sure your readers know where to look for these links? Then use Custom Fields.
So I’ve listed five possible uses for custom fields, hopefully you can see a use for them on your blog. If you want to make the most of them, you will need to prepare your blog first. For a bit of background, have a look at the WordPress Codex, specifically, the Using Custom Fields page and the the_meta function. There’s also a nice run through of an implementation here and here.