I’ve been trying to do something with custom fields but I’m not having any luck. How can I check for the existence of a particular custom field, and then take action depending on the result?
If: A custom field called “background” exists and has a value
Then: Do something
Else: Do something different
Basically I’m using a custom field “background” on my pages and posts which holds an image file name. When that page or post is displayed, the image is used as the page background. Currently if no image is specified there is no background.
The reason I want to do this is that if a post does not have an actual background image specified by the custom field, then I want to use a generic one.
This seems like it ought to be straightforward but my grasp of PHP is not strong enough to quite manage it, any help would be gratefully received!
- The topic ‘Check for the existence of a custom field’ is closed to new replies.