Created
October 4, 2012 16:43
-
-
Save billrobbins/3834847 to your computer and use it in GitHub Desktop.
Gallery Full
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* | |
* Display of galleries on single posts | |
* | |
*/ | |
$args = array( | |
'post_type' => 'attachment', | |
'post_mime_type' => 'image', | |
'post_status' => 'inherit', | |
'post_parent' => $post->ID, | |
'posts_per_page' => '-1', | |
'order' => 'ASC', | |
'orderby' => 'menu_order' | |
); | |
$images = new WP_Query( $args ); | |
if( !$images->have_posts() ) | |
return; | |
while( $images->have_posts() ): $images->the_post(); global $post; | |
$parent_title = get_the_title($post->post_parent); | |
$image = wp_get_attachment_image_src( $post->ID, 'feature' ); | |
$image_full = wp_get_attachment_image_src( $post->ID, 'large' ); | |
$image_attributes = wp_get_attachment_image_src( $post->ID, 'large' ); | |
$caption = get_the_excerpt( $post->ID, 'post_excerpt' ); | |
echo '<a class="lightbox" rel="'.$parent_title.'" title="'.$caption.'" href="'; | |
echo $image_full[0] . '">'; | |
echo '<img class="shadow" src="'; | |
echo $image[0] . '" width="'.$image_attributes[1] .'" height="'.$image_attributes[2].'" />'; | |
echo '</a>'; | |
echo ' | |
'; | |
endwhile; wp_reset_query(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment