My Gallery Photos are showing in the post’s excerpts

   if(  ( is_page() || is_single() ) && ( !is_home() &&  !is_front_page() )  ){
        $content = strip_shortcodes( $original_content); 
    }

if its home or front page don’t show gallery

    if( is_home() || is_front_page() ) {
          // don't show gallery
          $content = strip_shortcodes( $original_content); 
    } else {
          $content = get_the_image( array( 'size' => 'full' ) );
          $content .= $original_content;
    }

The post was using shorttags to print the gallery, get_the_image() printed the thumbnail.

so by removing the shorttags from appearing in the front page, the gallery no longer is shown on it, but will show on other pages, and also, categories, tags etc.

To further improve on that, add || is_archive() to the conditional above.

reference for is_home() and strip_shortcodes()


just for fun:

truth table:

  • 0 0 0 1 = ( 0 || 0 ) && ( 1 && 0 ) = 0 && 1 = 0
  • 0 0 1 0 = ( 0 || 0 ) && ( 0 && 1 ) = 0
  • 0 0 1 1 = 0
  • 0 1 0 0 = 0
  • … = 0
  • 1 0 0 0 = 1
  • 0 1 0 0 = 1
  • 1 1 0 0 = 1
  • … = 0