SHARE
TWEET

Untitled

a guest Dec 14th, 2011 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php get_header(); ?>
  2.  
  3. <!-- Begin wrap -->
  4. <div id="container">
  5. <div id="post_content">
  6.  
  7. <!-- Grab posts -->
  8. <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  9.  
  10. <!-- Dont' touch this code! -->
  11. <?php
  12.         $parent = $post->post_parent;
  13.         $attachments = array_values(get_children(array('post_parent' => $post->post_parent, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'ID') ) );
  14.         foreach ( $attachments as $k => $attachment )
  15.         if ( $attachment->ID == $post->ID )
  16.           break;
  17.         $next = $k+1;
  18.         $prev = $k-1;
  19.         $next_link = "";
  20.         $prev_link = "";
  21.         if ( isset($attachments[$next]) )
  22.         {
  23.           $next_exists = 1;
  24.           $next_link = "<a href='" . get_attachment_link( $attachments[$next]->ID ) . "'> &raquo;</a>";
  25.           $img_link = "<a href='" . get_attachment_link( $attachments[$next]->ID ) . "'>";
  26.         }
  27.  
  28.         if ( isset($attachments[$prev]) )
  29.         {
  30.           $prev_exists = 1;
  31.           $prev_link = "<a href='" . get_attachment_link( $attachments[$prev]->ID ) . "'> &laquo;</a>";
  32.           if  (!$next_exists)
  33.           {
  34.             $img_link = "<a href='" . get_attachment_link( $attachments[$prev]->ID ) . "'>";
  35.           }
  36.         }
  37.         if (!$next_exists and !$prev_exists)
  38.         {
  39.           $img_link = "<a href='" . get_attachment_link( $attachments[$k]->ID ) . "'>";
  40.         }
  41.         $img_url = wp_get_attachment_url( $attachments[$k]->ID );
  42.         if (sizeof($matches) > 1)
  43.         {
  44.           $fn = "/home/phasenet/public_html" . $matches[1];
  45.           $exif_data = read_exif_data($fn);
  46.         }
  47.       ?>
  48.  
  49.  
  50. <!-- Next/Previous Posts -->
  51. <div class="mp_full">
  52. <div id="more_posts_full">
  53. <div class="mp_full_adjust">
  54. <div class="oe"><?php echo $prev_link ?></div>
  55. <div class="re"><?php echo $next_link ?></div>
  56. </div>
  57. </div>
  58. </div>
  59.  
  60. <!-- Post title -->
  61. <h1 class="post">
  62.         <?php echo get_the_title($post->post_parent); ?>
  63. </h1>
  64.  
  65. <!-- Get the image, its caption, and description -->
  66. <?php echo wp_get_attachment_image( $post->ID, 'large' ); ?>
  67.  
  68. <h2><?php if ( !empty($post->post_excerpt) ) the_excerpt(); ?></h2>
  69.  
  70. <?php the_content(); ?>
  71.  
  72.  
  73.  
  74. <?php
  75. $gallery_images = new WP_Query(array(
  76.     'post_parent' => $post->ID,
  77.     'post_type' => 'attachment',
  78.     'post_mime_type' => 'image',
  79.     'post_status' => 'inherit',
  80.     )
  81. );
  82.       ?>
  83.  
  84. <?php
  85. while ( $gallery_images->have_posts() ) : $gallery_images->the_post();
  86.     the_title();
  87.     the_content();
  88.     the_permalink();
  89.     whatever();
  90. endwhile;
  91.  
  92. // always reset the post data at the end of any non-main loop
  93. wp_reset_postdata();
  94.       ?>
  95.  
  96.  
  97.  
  98. <?php endwhile; else: ?>
  99. <p>Sorry, no attachments matched your criteria.</p>
  100. <?php endif; ?>
  101.  
  102. <!-- End wrap -->
  103. </div>
  104.         <?php get_sidebar(); ?>
  105.  
  106. </div>
  107.   </div>
  108.  
  109.  
  110. <?php get_footer(); ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top