• 1.
    <?php get_header(); ?>
  • 2.
     
  • 3.
    <!-- Remember Post Views -->
  • 4.
    <?php setPostViews(get_the_ID()); ?>
  • 5.
     
  • 6.
    <?php get_sidebar(); ?>
  • 7.
     
  • 8.
    <!-- Begin wrap -->
  • 9.
    <div id="content">
  • 10.
     
  • 11.
    <!-- The Loop -->
  • 12.
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  • 13.
     
  • 14.
    <!-- Post title -->
  • 15.
    <h1 class="imageattachment">
  • 16.
    	<?php echo get_the_title($post->post_parent); ?>
  • 17.
    </h1>
  • 18.
     
  • 19.
    <!-- Next/Previous entries -->
  • 20.
    <?php previous_image_link( false, 'Previous Image' ); ?>
  • 21.
    <?php next_image_link( false, 'Next Image' ); ?>
  • 22.
     
  • 23.
     
  • 24.
    <?php global $post; echo '<pre>'.print_r( get_children('post_type=attachment&post_mime_type=image&output=ARRAY_N&orderby=m‌‚Äčenu_order&order=ASC&post_parent='.$post->post_parent).'</pre>'; ?>
  • 25.
     
  • 26.
    <!-- Get the image -->
  • 27.
    <?php echo wp_get_attachment_image( $post->ID, 'large' ); ?>
  • 28.
     
  • 29.
    <!-- Image Caption/Title -->
  • 30.
    <h2 class="imageattachment">
  • 31.
    <?php
  • 32.
    if (!empty($post->post_excerpt)) {
  • 33.
      $excerpt_raw = strip_tags(get_the_excerpt()); 
  • 34.
      echo $excerpt_raw;
  • 35.
    }
  • 36.
    ?>
  • 37.
    </h2>
  • 38.
     
  • 39.
    <!-- Image Description -->
  • 40.
    <?php the_content(); ?>
  • 41.
     
  • 42.
     
  • 43.
    <?php endwhile; else: ?>
  • 44.
    <p>Sorry, no attachments matched your criteria.</p>
  • 45.
    <?php endif; ?>
  • 46.
     
  • 47.
    <!-- End wrap -->
  • 48.
    </div>
  • 49.
    </div>
  • 50.
    <?php get_footer(); ?>
<?php get_header(); ?> <!-- Remember Post Views --> <?php setPostViews(get_the_ID()); ?> <?php get_sidebar(); ?> <!-- Begin wrap --> <div id="content"> <!-- The Loop --> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <!-- Post title --> <h1 class="imageattachment"> <?php echo get_the_title($post->post_parent); ?> </h1> <!-- Next/Previous entries --> <?php previous_image_link( false, 'Previous Image' ); ?> <?php next_image_link( false, 'Next Image' ); ?> <?php global $post; echo '<pre>'.print_r( get_children('post_type=attachment&post_mime_type=image&output=ARRAY_N&orderby=m‌‚Äčenu_order&order=ASC&post_parent='.$post->post_parent).'</pre>'; ?> <!-- Get the image --> <?php echo wp_get_attachment_image( $post->ID, 'large' ); ?> <!-- Image Caption/Title --> <h2 class="imageattachment"> <?php if (!empty($post->post_excerpt)) { $excerpt_raw = strip_tags(get_the_excerpt()); echo $excerpt_raw; } ?> </h2> <!-- Image Description --> <?php the_content(); ?> <?php endwhile; else: ?> <p>Sorry, no attachments matched your criteria.</p> <?php endif; ?> <!-- End wrap --> </div> </div> <?php get_footer(); ?>

Copy Code to Clipboard Raw

Sign-in or Create a Free Account.

Snippi uses Twitter or Facebook to register and create accounts. Registration will enable you to keep track of your snippets. We never spam your timeline or wall. Ever.

Sign-in with Facebook Sign-in with Twitter