Title: Image gallery image.php problems
Last modified: August 19, 2016

---

# Image gallery image.php problems

 *  [brendanw](https://wordpress.org/support/users/brendanw/)
 * (@brendanw)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/image-gallery-imagephp-problems/)
 * Im currently working on my site trying to get my blog all ironed out before i
   start posting to it. this blog is hopefully to make a little money so i want 
   to be able to put ads everywhere i can on it. so ive got my images opening up
   full size on a page after they are clicked and ive made it go to the next photo
   in the gallery once its clicked.
 * the url is [http://www.selfshotblog.net/blog](http://www.selfshotblog.net/blog)
   if you want to have a look.
 * I want the comments section and the footer to be aligned to the centre at the
   bottom and the comments section and the paragraph of text to be to as wide as
   the footer and im completely stumped on this.
 * The image.php that im using has been patched together from a bunch of different
   posts on the net and has probably got plenty of irrelevant stuff in there that
   does nothing.
 * Can anybody help me out here?
 *     ```
       <?php
       get_header();
       ?>
   
         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
   
       		 <div class="post" id="post-<?php the_ID(); ?>">
       			<h2><a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php echo get_the_title($post->post_parent); ?></a> &raquo; <?php the_title(); ?></h2>
       ```
   
 * <?php
    // code copied from adjacent_image_link() in wp-include/media.php $attachments
   = array_values(get_children( array(‘post_parent’ => $post->post_parent, ‘post_status’
   => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’
   => ‘ASC’, ‘orderby’ => ‘menu_order ID’) )); foreach ( $attachments as $k => $
   attachment ) if ( $attachment->ID == $post->ID ) break;
 * $next_url = isset($attachments[$k+1]) ? get_permalink($attachments[$k+1]->ID):
   get_permalink($attachments[0]->ID);
    ?>
 * </p>
 *  <div class=”navigation”>
    <div class=”alignleft”><?php previous_image_link()?
   ></div> <div class=”alignright”><?php next_image_link() ?></div> </div> <br class
   =”clear” />
 *  <p class=”postmetadata alt”>
    <small> This entry was posted on <?php the_time(‘
   l, F jS, Y’) ?> at <?php the_time() ?> and is filed under <?php the_category(‘,‘)?
   >. <?php the_taxonomies(); ?> You can follow any responses to this entry through
   the <?php post_comments_feed_link(‘RSS 2.0’); ?> feed.
 *  <?php if ((‘open’ == $post-> comment_status) && (‘open’ == $post->ping_status)){
   //
   Both Comments and Pings are open ?> You can [leave a response](https://wordpress.org/support/topic/image-gallery-imagephp-problems/?output_format=md#respond),
   or ” rel=”trackback”>trackback from your own site.
 *  <?php } elseif (!(‘open’ == $post-> comment_status) && (‘open’ == $post->ping_status)){
   //
   Only Pings are Open ?> Responses are currently closed, but you can  ” rel=”trackback”
   >trackback from your own site.
 *  <?php } elseif ((‘open’ == $post-> comment_status) && !(‘open’ == $post->ping_status)){
   //
   Comments are open, Pings are not ?> You can skip to the end and leave a response.
   Pinging is currently not allowed.
 *  <?php } elseif (!(‘open’ == $post-> comment_status) && !(‘open’ == $post->ping_status)){
   //
   Neither Comments, nor Pings are open ?> Both comments and pings are currently
   closed.
 *  <?php } edit_post_link(‘Edit this entry.’,”,”); ?>
 *  </small>
    </p>
 *  </div>
 *  </div>
 *  <?php comments_template(); ?>
 *  <?php endwhile; else: ?>
 *  <p>Sorry, no attachments matched your criteria.</p>
 * <?php endif; ?>
 *  </div>
 * <?php get_footer(); ?>
    `

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [brendanw](https://wordpress.org/support/users/brendanw/)
 * (@brendanw)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/image-gallery-imagephp-problems/#post-1040084)
 * obviously stuffed up in indented code thing there.. :O
 *  Thread Starter [brendanw](https://wordpress.org/support/users/brendanw/)
 * (@brendanw)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/image-gallery-imagephp-problems/#post-1040159)
 * help?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Image gallery image.php problems’ is closed to new replies.

## Tags

 * [gallery](https://wordpress.org/support/topic-tag/gallery/)
 * [image](https://wordpress.org/support/topic-tag/image/)
 * [image.php](https://wordpress.org/support/topic-tag/image-php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 1 participant
 * Last reply from: [brendanw](https://wordpress.org/support/users/brendanw/)
 * Last activity: [17 years, 2 months ago](https://wordpress.org/support/topic/image-gallery-imagephp-problems/#post-1040159)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
