<div class="entry-content">
<?php if ( post_password_required() ) : ?>
<?php the_content(); ?>
-<?php else : ?>
- <div class="gallery-thumb">
-<?php
- $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
- $total_images = count( $images );
- $image = array_shift( $images );
- $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
-?>
- <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
- </div><!-- .gallery-thumb -->
- <p><em><?php printf( __( 'This gallery contains <a %1$s>%2$s photos</a>.', 'twentyten' ),
- 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
- $total_images
- ); ?></em></p>
-
- <?php the_excerpt(); ?>
+<?php else : ?>
+ <?php
+ $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
+ if ( $images ) :
+ $total_images = count( $images );
+ $image = array_shift( $images );
+ $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
+ ?>
+ <div class="gallery-thumb">
+ <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
+ </div><!-- .gallery-thumb -->
+ <p><em><?php printf( __( 'This gallery contains <a %1$s>%2$s photos</a>.', 'twentyten' ),
+ 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
+ $total_images
+ ); ?></em></p>
+ <?php endif; ?>
+ <?php the_excerpt(); ?>
<?php endif; ?>
</div><!-- .entry-content -->