WordPress.org

Ready to get started?Download WordPress

Forums

Automate lightbox group rel [not plugin] w/ explode? (1 post)

  1. toxiccosmos
    Member
    Posted 3 years ago #

    I'm having trouble automating the group rel for lightbox 2. I've searched the forums but it seems that all topics relate to the plugin, which I don't wish to use. Here's an idea I had, which didn't pan out.

    <div id="thumbslider">
    <?php
    $thumbslide = get_post_meta($post->ID, "thumbslide", false);
    if ($thumbslide[0]=="") { ?>
    
    <!-- If there are no custom fields, show nothing -->
    
    <?php } else { ?>
    
    <?php foreach($thumbslide as $thumbslide) {
    $temp = explode("&", "$thumbslide");
    $thumbsmall = $temp[0];
    $thumbslidelarge = $temp[1];
    $group = $temp[2];
    echo '<a href="'.$thumbslidelarge.'" rel="lightbox['.$group.']"><img src="'.$thumbsmall.'" />
    </a>';
    } ?>
    
    <?php } ?>
    </div>

    http://varriaga.com/portfolio/

    I was trying to get the group from a custom field that I used to display the images and link them. Oddly enough, I don't get an error message. the thumbs load just fine, but when clicked on, the image does not load.

    I'd appreciate any help.

    I'd like to add, if it's possible, I would prefer to use the post title as the group rel as it would require less for me to do. I explored that option to the best of my ability, but I couldn't figure it out.

Topic Closed

This topic has been closed to new replies.

About this Topic