Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@turboclaw
Created December 18, 2012 00:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save turboclaw/4323944 to your computer and use it in GitHub Desktop.
Save turboclaw/4323944 to your computer and use it in GitHub Desktop.
Single post with an image gallery
<?php get_header(); ?>
<div class="leftside">
<?php while ( have_posts() ) : the_post(); ?>
<h3 class="title"><?php the_title(); ?></h3>
<h4 class="date"> ... </h4>
<div class="description">
<?php the_content(); ?>
</div>
<ul class="gallery_detail">
<?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' );
?>
<li><a class="lightbox" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a></li>
<?php endif; ?>
</ul>
<?php endwhile; ?>
</div><!-- /.leftside -->
<?php get_sidebar(); /* .rightside stuff */ ?>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment