Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I purchased a theme that I want to change a bit. I'm familiar with writing some if/else statements but not this type and not matter what I do, I can't add an else/if without breaking the code.

Below is the code from the theme...

<?php
   if (!is_404() && !is_attachment()) {
      if (is_singular() || is_page('gallery') || is_page('about') && has_post_thumbnail($post->ID) && ($image = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'post-thumbnail') ) && $image[1] >= HEADER_IMAGE_WIDTH) :
          echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
      else : ?>
          <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('name'); ?>" />
<?php endif; } ?>

The code shows a featured image as a banner on the pages where there is one. I am trying to write an else/if statement that doesn't show the featured image as a banner on the single post pages, and like I said, every time I try adding an else/if, I end up breaking the code.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

The conditional for posts is is_single(). So …

if ( ! is_404() && ! is_attachment() && ! is_single() ) {
    # rest of the code
}
share|improve this answer
    
Thanks so much, that did it! –  Leadbelly Design Feb 17 '13 at 17:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.