20+ Tutorials and Resources for Working with Custom Fields in WordPress
One of the keys to WordPress’s flexibility and endless possibilities is the use of custom fields. With custom fields you can do all kinds of things, but most designers and developers who are new to WordPress are not familiar with how to put custom fields into practice. In this post we’ll look at a number of tutorials that will show you some potential uses of custom fields, as well as a handful of plugins that make it easier or more productive to use custom fields.
This article from Justin Tadlock gives an overview of custom fields, and it’s actually the introductory post to a series on the subject of custom fields (other posts in the series are included in the list). If you’re not familiar with custom fields or if you just want to make sure you get the basics before moving further, this article is a great starting point.
The WordPress Codex of course provides some documentation on the subject of custom fields. Although many of the articles that are featured here will get into more specifics, it’s always a good idea to remeber that the codex is available when you have questions, or keep useful articles on the Codex like this one bookmarked.
Jin Yang explains custom fields and shows how you can use them to customize a blog post by styling the background. In the example he chooses a custom background image for the post, which is a pretty cool trick for making your blog unique.
Perishable Press has a two=part series on custom fields. The first part includes some basic information and shows a few ways that custom fields can be used, including adding images to the sidebar.
The second part of the Perishable Press series goes into more detail on working with custom fields. The article covers topics like conditional display of custom field data, and showing data only if a custom field exists.
One of the more common uses for custom fields is to add images to a post. This article is part of Justin Tadlock’s series and he provides all the instruction and code that you will need to get a custom field to show an image on your posts.
Tutorial9 also provides a similar tutorial for giving the basics of custom fields and using them to show thumbnails on the front page or on the post page.
Derek Punsalan shows a really nice approach to use a custom field for adding a background image behind the post title. This is another way to take advantage of the power of custom fields to create a blog that looks a little more unique.
This is a brif post from WPRecipes that explains how you can the value of a custom field, with the necessary code provided.
In this article Nathan Rice shows a way to get the contents of a custom field by using less code. His approach involves editing the functions.php file, which he explains.
This article shows how you can use custom fields in situations where a post may have zero, one or multiple values of the same custom code. The example used in the tutorial is quotes. Some post may have none, while others may have several.
This post shows how you can use custom fields to add AdSense or other ads to specific posts. While there are plugins for this purpose, knowing how to do it manually is never a bad thing.
This is another post in Justin Tadlock’s series. In this article he shows how you can add YouTube videos to your sidebar, controlled by custom fields. This is an interesting idea that you don’t see in action very often, but could have a lot of potential in the right situation.
If you often write posts in a series, Justin Tadlock shows how you can list other posts from the series by using custom fields. The end result would be similar to a related posts plugin, except you would have more control over which posts are listed.
Darren Hoyt has a two-part series about template tags and magazine-style themes. In the second part he covers a number of items, including custom fields as they relate to the magazine-style layout.
Chris Cagle’s article covers three things you can do with custom fields: 1) a custom “read more”, 2) awesome thumbnailed recent posts, and 3) post-specific CSS overrides.
Raj Dash’s article on Performancing can be helpful for seeing the potential of custom fields. You may see a few ideas on here that you hadn’t thought of before that would be useful on your site or for a client project.
While custom fields have plenty of power and potential, they’re not always the most user-friendly for clients. Function has provided this tutorial for creating custom write panels that will allow you to accomplish the same things as custom fields, but may be a little more manageable for some people, especially non-tech-savvy clients.
Plugins for Working with Custom Fields:
In addition to the tutorials featured above, there are a number of plugins that enhance the use of custom fields in some way, or make them easier to use. Here is a small sampling of useful plugins that are compatible with the latest version of WordPress, 2.7.1.
This plugin adds the default custom fields on the Write Post/Page, making it a little bit easier to work with.
You can use this plugin to show custom fields in your posts by using shortcode, with no modification required for your theme.
With this plugin you can easily add images to your posts, pages and feeds. There is also functionality to display recent posts as images instead of text links.
Custom Field Taxonomies will allow you to enhance the capabilities of your site by making some of your custom fields act like tags.
This plugin will allow you to easily show custom field data in the sidebar of specific posts, providing essentially limitless possibilities.
This plugin lists all values of a choosable custom field name, groups the values of of a post and (hyper-) links the values to their posts as a sidebar widget.
This plugin helps to improve the functionality of the WordPress search by allowing multiple form inputs to search different aspects of a post. An example use (and the reason the plugin was created) is for searching a real estate website by factors such as price.
More Fields is a WordPress plugin that adds boxes to the Write/Edit page. These boxes contains input fields, so that additional (more) fields can be added to a post.
For more WordPress-related content, please see: