Support » Themes and Templates » Twenty Eleven Gallery page

  • Hi,

    I am using Twenty eleven theme and post format…. When I create a gallery post format, I would like to have all thumbs appear directly on the post.

    The way it is now: the post that contains a gallery shows a thumb with a text saying the number of photo included. Then we have to click on it to get to the page with all the thumbs…

    I tried to play with content-gallery.php but after hours i didn’t get the answer…

    Any help ?

    Thank you

Viewing 5 replies - 1 through 5 (of 5 total)
  • esmi


    Forum Moderator

    Do not edit the Twenty Eleven theme. It is the default WordPress theme and having access to an unedited version of the theme is vital when dealing with a range of site issues. First create a child theme for your changes.

    Thank you…

    Do you know what do change then ?

    Should be simple to have the gallery thumbs display directly on the first post… Any clue someone ?

    Thank you 🙂



    Forum Moderator

    You;d have to replace:

    <?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' );?>
    <figure class="gallery-thumb">
    <a href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
    </figure><!-- .gallery-thumb -->
    <p><em><?php printf( _n( 'This gallery contains <a %1$s>%2$s photo</a>.', 'This gallery contains <a %1$s>%2$s photos</a>.', $total_images, 'twentyeleven' ),
    'href="' . esc_url( get_permalink() ) . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
    number_format_i18n( $total_images )
    ); ?></em></p>

    in your child’s content-gallery.php file with something like <?php the_content();?>.

    Thank you 🙂

    I also deleted

    <?php else : ?>
    <?php endif; ?>

    In the beginning and the end of this piece of code.. Otherwise it broke the page…


    <?php the_content();?>

    doesn’t bring anything… I only have now the title of the gallery post…

    We are getting close…

    Thank you


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Twenty Eleven Gallery page’ is closed to new replies.