title: Using Custom Field to pull in image - if no img can the DIV not display? WordPress / php / CSS
body: <p>This is what I am using:</p>
  
  <pre><code>&lt;div class="banner"&gt;
  &lt;?php if(get_post_meta($post-&gt;ID, 'banner', true)) : ?&gt;
  &lt;img src="&lt;?php echo get_post_meta($post-&gt;ID, 'banner', true); ?&gt;" /&gt;
  &lt;?php else : ?&gt;
  &lt;?php the_title(); ?&gt;
  &lt;?php endif; ?&gt;
  &lt;div&gt;`
  </code></pre>
  
  <p>and..</p>
  
  <pre><code>#banner {
  clear:both;
  width:980px;
  overflow: hidden;
  background: #F4F5F6;
  padding:12px 0;
  margin: 0 0 15px 0;
  -moz-border-radius:15px;
  -webkit-border-radius: 15px;
  border-radius: 15px; /* future proofing */
  -khtml-border-radius:15px; /* for old Konqueror browsers */
  }
  
  #banner img {display: block; margin:0 auto;}
  </code></pre>
  
  <ol>
  <li><p>I don't want a title displayed so that if/else is not necessary. </p></li>
  <li><p>If there is no img / the custom field is not being used, can the div just not show?  Right now if the custom field is not being used it is still showing an empty div.</p></li>
  </ol>
  
  <p>SOLVED IT!!! Sorry for even posting here. Though it's not pretty, it works.</p>
  
  <pre><code>&lt;div id="bannerHolder"&gt;
  &lt;?php if(get_post_meta($post-&gt;ID, 'banner', true)) : ?&gt;
  &lt;div id="banner"&gt;
  &lt;img src="&lt;?php echo get_post_meta($post-&gt;ID, 'banner', true); ?&gt;" /&gt;
  &lt;/div&gt;&lt;!--banner--&gt;
  &lt;?php else : ?&gt;
  &lt;?php endif; ?&gt;
  &lt;/div&gt;&lt;!--bannerholder--&gt;
  </code></pre>