Adding unique headers to pages using custom fields
-
I would like to be able to add different banner images to different pages. So far I found this thread https://www.ads-software.com/support/topic/how-to-add-different-header-image-for-every-page?replies=31
I’ve created a custom field called banner and inserted the following code into my header.php
<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>
However on my pages where I don’t have the banner, it’s listing the page title twice. How can I remove the page title from the code above?
Thanks
- The topic ‘Adding unique headers to pages using custom fields’ is closed to new replies.