WordPress Custom Fields

Using WordPress custom fields is a great way to add meta data to your posts that you can manipulate easily.  Say, for instance, that you would like to include a picture with all of your posts, but you would like to be able to access it from outside of the standard the_content() or the_excerpt() functions. By using custom fields you can simply define a key and a value that can be accessed at any point with the get_post_meta() function.

Say you define a custom field key called Image-Slice, with a value that creates a link to the blog post using an image tag:

Wordpress Custom Field

Wordpress Custom Field

You can then access that field from within the loop by using a simple php snippet:

<?php $key="Image-Slice"; echo get_post_meta($post->ID, $key, true); ?>

I’ve found this technique very useful to create websites that use a custom field as a design element.

« Previous Page