I'm using a custom field to position a standard position image in my posts.
Not really knowing what I'm doing, I found an example somewhere and tried this:
custom field - image
I put this in the kicker area of the page/posts:
<img src="/wp-content/uploads/%meta('image')%" alt="%post-title%" />
This works fine as long as there is an image reference in the image field.
However, if the field is blank, I get an error plus an empty image box.
I can make this work by placing a blank .gif in the field every time I post something, but this will drive me crazy eventually.
Is there some php code that would insert the image if there is a value in the field, but leave the area blank (without error and image box) if there is no custom image field - or if the image field is blank?
If conditional code is not possible, would I be able to create a the field with a default value the same way that the meta fields are created when a new post is saved (I couldn't find where this was done).
I want to avoid anything that would be wiped out with theme upgrades.
Thanks!