3 Fun Conditional Tricks for Your WordPress Custom Fields
Mar 01, 2011, 17:02 (0 Talkback[s])
(Other stories by Sukrit Dhandhania)
Re-Imagining Linux Platforms to Meet the Needs of Cloud Service Providers
"In the first article of the WordPress Custom Fields series we
looked at what fields are and how to create and display them. We
also looked at how to check and display a field only if it has a
value. Assuming that you have read that article and are more or
less familiar with the basics of using custom fields, let's now
look at doing more fun things with custom fields.
"To quickly recap the idea of custom fields, they are made of
two parts: the key and the value. You define a key once, which is
usually universal to your WordPress setup, and the value can be
defined on a per post basis. You can also set multiple values to a
key in a single post.
"WordPress Custom Field Trick #1: Display Multiple Values of
"Suppose you are creating a page to display your restaurant
menu. A page displaying the menu could have multiple deserts. If
your key is called Desert_Type, you can declare multiple values to
it. For example, you may have Chocolate Truffle, Orange Cake, and
Pudding on the menu. Add the following in your WordPress Post as
custom field entries:"