Using Custom Field to pull in image – if no img can the DIV not display?
-
This is what I am using:
<div class="banner"> <?php if(get_post_meta($post->ID, 'banner', true)) : ?> <img src="<?php echo get_post_meta($post->ID, 'banner', true); ?>" /> <?php else : ?> <?php the_title(); ?> <?php endif; ?> <div>
and..
#banner { clear:both; width:980px; overflow: hidden; background: #F4F5F6; -moz-border-radius:15px; -webkit-border-radius: 15px; border-radius: 15px; /* future proofing */ -khtml-border-radius:15px; /* for old Konqueror browsers */ padding:12px 0; margin: 0 0 15px 0; } #banner img { display: block; margin:0 auto; }
I don’t want a title displayed. If there is no img in the custom field can the div just not show?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Using Custom Field to pull in image – if no img can the DIV not display?’ is closed to new replies.