WordPress News

What are WordPress Custom Fields?

Custom Fields allow you to add information to your posts. WordPress, by default displays a custom field box below the post editor depending on which theme you are using.

The custom field data is paired using a Name (key) and a Value (information). WordPress calls this meta data.

Custom fields require 2 parts to work. The custom fields (1) and the php function code (2)

If you’re a coder or Developer then custom fields like custom post types are great for customizing WordPress. If not, try a theme which already includes built in custom field settings so you don’t need to edit PHP code or install a plugin. More on this below.

Custom Fields

If you wanted to add a link to an image or post, you would insert a name for the custom field (key) and a URL (value).

Custom Fields Box

Theme Custom Settings

If you’re a non coder then you may find creating custom fields a problem as you also need to add PHP code to your themes php files to make your custom fields function.

The best solution in this case is to find a theme which includes built in custom settings or install a custom fields plugin.

Both solutions are discussed further on in this tutorial. Some themes display their own custom fields which are not offered in the WordPress default theme.

For example: The Canvas theme by Woo Themes offers built in Canvas Custom Settings.

Here’s a look at what i am talking about:

Canvas Custom Settings

As you can see in the screenshot above, Canvas has its own custom settings which replace the WordPress custom fields. The custom fields already built into the Woo framework on each post allow you to add a unique image for each post which will be displayed on the homepage, category & tag pages.

You also have custom fields for different layouts and the option of embedding video into the posts using the custom field. These are the most popular examples of custom fields which have already been coded into this theme & framework and don’t come standard on most free themes.

Where Do i Find Custom Fields

The custom fields module is located below your editor in the post edit screen. In the latest WordPress versions, you may need to click on the Screen Options tab located top right of your screen and select Custom Fields checkbox to display custom fields below your editor.

Some versions of WordPress hide different modules including the custom fields module in the screen options.

You should now be able to scroll down and find Custom Fields.

Screen Options - Custom Fields

Video Introduction to Custom Fields

Default WordPress Custom Fields

Here’s a screenshot showing you what custom fields look like in the 2011 default theme for WordPress, Twenty Eleven. The custom fields you will find below your post editor screen only provide the Name and Value fields.

Edit Post - Add New Custom Field

This is ONLY part of the function which creates a working custom field as you also need to add PHP code to make your name and value fields function.

Custom Field Plugin

One of the easiest ways to use WordPress custom fields, if you don’t want to edit PHP files, is to install a plugin. There’s a large range of plugins which cover both custom fields and custom field templates (already include the code).

NGG Custom Fields Plugin

As an example, you can read more about the Next Gen Gallery NGG custom fields plugin which shows you the basics of how custom fields work to make images clickable to a URL.

Using Custom Fields to Display Post Images

One of the most common uses of WordPress custom fields is to display a unique image for each post. To create a custom field you’ll need to add both a Name and a Value in the custom field provided.

You will also need to add php code to make the custom field work as it won’t work simply by entering a name and value.

Once you have setup your custom field(s), they will show up in the drop down menu on each post so you can easily use them over and over again without having to edit code in your themes files again.

Some themes already offer built in custom settings which makes it super easy to use custom fields, however, if you’re using a theme which doesn’t offer a custom field already incorporated into your theme, you will need to make use of WordPress custom fields manually.

One of the greatest benefits of setting up a custom field is, once its setup, you can use it on any post quickly and easily without having to edit your themes php files again.

One reply on “What are WordPress Custom Fields?”

Leave a Reply

Your email address will not be published. Required fields are marked *