Hello there,
I'm trying to display 6 random post images as a sidebar widget in the Newscast theme (2.0.2, WP 3.1.1) and open them in Lightbox to view these images when the user clicks on any of them (same behavior as in single post view). I am pretty sure someone already asked about Image Galleries in the sidebar and was directed to a Gallery plugin instead, but I couldn't find the thread.
So far, I'm able to display the images just fine, but I don't know how to force Lightbox to trap them and display them:
<div class="image-gallery">
<?php
$image_query = new WP_Query('posts_per_page=6&orderby=rand&cat=-23,-25');
$imageArray = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'thumbnail_name' );
$imageURL = $imageArray[0];
while ($image_query->have_posts()) : $image_query->the_post(); ?>
<div class="imagebox"><a title="<?php the_title(); ?>" href="<?php echo $imageURL; ?>" rel="bookmark"><?php the_post_thumbnail(array(61,61), array ('class' => 'rounded3')); ?></a></div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</div>
I also tried to integrate the preview_image variable contained in single.php file into the above code but I was unsuccessful.
It would be desirable if all 6 pictures could be browsed from Lightbox as well. Thanks for your help.














