3 Fun Conditional Tricks for Your WordPress Custom Fields | Linux Today

3 Fun Conditional Tricks for Your WordPress Custom Fields

Written By
Web Webster
Web Webster
Mar 1, 2011

“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
Same Key

“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:”


Complete Story

Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.