Just a test

November 8th, 2009

Using custom fields and get_post_meta() in a Wordpress theme

March 10th, 2009

Wordpress 2.7 allows us to define custom fields when creating or editing posts. Using these custom values is not difficult, but will take a little bit of fussin’ with your theme.

Why use custom fields?

For several years, I’ve wanted a subtitle for posts. The title is great - a nice big H1 tag (on my themes) that is rich with keywords, but generally not at all cool or creative sounding. “3 Days In Hell” might catch your attention, but “Programming the USPS Address Verification API in PHP” may describe the post content in a more search-optimized manner. When presented with two desirable alternatives, my preference (as is so often the case) is to say, “I’d like both please!”

This is where custom fields come in - I can have both an SEO-friendly title, and a catchy subtitle, and chose where and how to present each. As an added bonus, I can create a dozen other custom fields I might want to pull into the post too.

Ad Hoc insertions

Insert the following line of code in your template where you wish to display the custom field:

Read the rest of this entry »

Test post 2

January 31st, 2009

There are strange things done in the midnight sun / by the men who moil for gold.

The arctic trails have their secret tales / that would make your blood run cold!

The northern lights have seen queer sights / but the queerest they ever did see

Was that night on the marge of Lake LeBarge / I cremated Sam McGee.

Hello world!

January 30th, 2009

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!