I need to have the post thumbnail image link to a gallery of post attachements displayed using pirobox. This is the code i use:
<?php if(has_post_thumbnail()){?>
<div class="post-single-images left">
<a href="<?php echo wp_get_attachment_url( get_post_thumbnail_id() )?>" class="pirobox_gall" title="<?php the_title(); ?>" rel="gallery">
<?php the_post_thumbnail('single'); ?></a>
</div><?php }?>
<?php
$attachments = get_children( array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'image' ) );
foreach ( $attachments as $attachment_id => $attachment ) {
echo '<a href="';
echo '' . wp_get_attachment_url( $attachment_id ) . '" class="pirobox_gall" title="<?php the_title(); ?>" rel="gallery">';
echo '<img style="display:none;" src="' . wp_get_attachment_url( $attachment_id ) . '" >';
} ?>
I'm getting the post thumbnail image (first in attachements) repeated five or more times in the pirobox slideshow - see here: http://anarita.me/protocolar/portfolios/inauguracao-do-cinema-city-alvalade/ -, and can't understand why.
Can someone help me?
Thank you, Ana Rita
<ul><li><a><img></a></li></ul>structure, try that... – brasofilo Jun 22 '12 at 15:58