You can find this code below inside "content-gallery.php" (twentyeleven theme)
<?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' ); ?>
The problem here is:
1. When a post is a gallery post, that post will show a gallery of images.
The question is: How do i display an image inside that gallery?
The answer is very ugly: You upload your image by using the media button when you're editing your post. That way, that image will be a child of that post. UGLY!!!
Why? Because this is a one-to-one relationship which means you can only use that image for ONE GALLERY ONLY! What do i need to do to use that image for another gallery? You upload another copy of that image.
WordPress, please fix this one-to-one relationship. It's ugly