WordPress Custom Fields
Posted on January 22nd, 2008 by JTkPosted in Themes, WordPress | No Comments »
One of the most powerful, but under-used features in WordPress is the Custom Fields features.
WordPress says:
WordPress has the ability to allow post authors to assign custom fields to a post. This arbitrary extra information is known as meta-data.
You can find the Custom Field entry form near the bottom of the Create New Post section of the administration backend, but to use it you will need to hack up your WordPress theme somewhat to get the data to show up. The data itself can be just about anything - your current location, mood, etc. - I have used it in the past so a client could include a photo thumbnail in each post at a specific place in his WordPress theme that was not possible through the standard post form.
This is the code that I used to impleiment the custom thumbnail:
<?php //get article_image (custom field) ?>
<?php $image = get_post_meta($post->ID, ‘article_image’, true); ?>
<img src="<?php echo $image; ?>" alt="<?php the_title(); ?>" />
My suggestion is that you check out the WordPress codex about the custom field but don’t get bogged down in the examples that they show you. You can do almost anything with this data so get creative and start using the WordPress Custom Fields!
