views:

10

answers:

0

I am trying to make a custom slider with a lightbox gallery built into it for wordpress use. I basically popped the colorbox plugin inside of the easyslider plugin. I have it working great, but I need a text link sitting below the slider that will also open the gallery, starting at image 1 and going to last. As it is now, clicking the image itself works perfect. But clicking on the secondary text link, it opens the gallery and starts at image 1, then 2, then 1 again and continues to the end. Can you think of how to fix that? Thank you for any ideas, and here is the relevant code. Thanks again.

<?php 

$attachments = get_children(array("post_type" => "attachment", "post_parent" => $pId, "post_type" => "attachment", "post_mime_type" => "image", "order" => "DESC")); 

/* If attachments is not empty, create slider */
if(!empty($attachments)) :?>

<?php 
/* Set max width and height in pixels */
$max_width = 960;
$max_height = 612;
?>

<div id="wide_post_gallery">
    <div id="slider">
        <ul>        
        <?php 
        /* Loop through the attachments */
        foreach($attachments as $attachement => $this_attachment) : 
        $image_src = wp_get_attachment_image_src($this_attachment->ID,'full');
        ?>
            <li>
                <a rel="gobig" href="<?php echo $image_src[0]; ?>">
                    <img src="<?php bloginfo('template_directory'); ?>/functions/timthumb.php?src=<?php echo $image_src[0]; ?>&amp;w=<?php echo $max_width; ?>&amp;h=<?php echo $max_height; ?>&amp;zc=0" alt="<?php the_title(); ?>" />
                </a>
            </li>

        <?php endforeach;

        $attachments = get_children(array("post_type" => "attachment", "post_parent" => $pId, "post_type" => "attachment", "post_mime_type" => "image", "order" => "ASC")); 

        foreach($attachments as $attachement => $this_attachment) :
        $image_src = wp_get_attachment_image_src($this_attachment->ID,'full');
        ?>

        <a rel="gobig" class="gobig" href="<?php echo $image_src[0]; ?>">VIEW FULL SCREEN</a>
        <?php endforeach; ?>

        </ul>
    </div> 
</div>       

<?php endif; ?>