DiggingIntoWordPress

by Chris Coyier & Jeff Starr

Daily archives: Wednesday, September 16, 2009

Global Custom Fields

Posted by on

UPDATE: Make sure to take out “Take Two” on this concept, with a cleaner method for doing this.

Custom fields allow us to attach data to Posts or Pages that we can yank out and use at will in our templates. They are awesomely flexible and single-handedly allow WordPress to be used for about any CMS need. The fact that they can only be used on single Posts can be limiting in some circumstances. Sometimes you wish you could grab a custom value that you can control and is consistent globally, regardless of the current post. In this post we’ll look at a technique to do so.

Code is poetry