using custom field in header
-
Please forgive my ignorance up front. I am a newbie with coding.
I am using this code in my header to display an image that is listed in the post custom field
<?php $img = get_post_meta($post->ID, 'header-image', true); if ($img) { echo "<img src='$img' />"; } else { echo "<img src='http://ictlive00.com/wp-content/uploads/Wichitanightskyline1220x250.jpg' />"; } ?>
It works except on home and category and such.
For regular pages it is displaying the else statement and for post pages it is displaying the image in the custom field.What do I need to add to display the else statement on home, category and archive pages?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘using custom field in header’ is closed to new replies.