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...

   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.


The conditional for posts is is_single(). So …

if ( ! is_404() && ! is_attachment() && ! is_single() ) {
    # rest of the code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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