i have a custom post type-> events. I have a gallery page in which the featured image from a custom post is used as album cover . Now when a person clicks on the album cover i.e featured image , i want to display images in attached gallery in the post. I have been using the following code to display the featured images in the main gallery page .But how do i show the rest of the images of the post. Please help me out.
<?php $paged= (get_query_var('paged' )) ? get_query_var('paged'):1; ?>
<?php $args = array( 'post_type'=>'events',
'posts_per_page' => 100 ,
'paged'=>$paged
);
$loop = new WP_Query( $args );
if($loop->have_posts()):while ( $loop->have_posts() ) : $loop->the_post();
?>
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array(225,225) ); ?>
<?php if(!$image) :continue; else:?>
<div class="col-lg-3 col-md-3 col-sm-3 gallerycol paddingdel-l">
<div class="about-img">
<div class="about-img-bot">
<div class="photo-quanity"></div>
</div>
<img class="img-responsive" src="<?php echo $image[0]; ?>" alt="" />
</div>
<div class="clearfix"></div>
<p><?php the_title(); ?> </p>
</div>
<?php endif; ?>
<?php endwhile;endif; ?>
If i put the featured image in the anchor tag with href="the_permalink" then it takes me to the template single-events.php which is having a lot of infomation . How do i display only the images in the attached gallery Any hint will be really helpful and appreciable
get_post_gallery()
) to bring the gallery for that post. For href use this codex.wordpress.org/Function_Reference/get_permalink – Pavel Adrian Jul 10 '14 at 12:35