• I’m using a theme with a number of sliders built in (flexslider(wooslider by another name), elastic slider, layer slider, revolution slider). The prettyPhoto javascript library is also pre-loaded into the theme(kitchen sink approach, I guess).

    So… I would like to enable one of the sliders to open into the prettyPhoto lightbox when clicked. I know I want to add the rel=”prettyPhoto” attribute to the images. I’ve seen this code slightly modified all over the place using the preg_replace expression, then the add_filter:

    `function addlightboxrel_replace($string)
    {
    $pattern = ‘/<a(.*?)href=”(.*?).(bmp|gif|jpeg|jpg|png)”(.*?)>/i’;
    $replacement = ‘<a$1href=”$2.$3″ rel=”Lightbox[imagegroup]$4>’;
    return preg_replace($pattern, $replacement, $string);
    }
    add_filter(‘the_content’, ‘addlightboxrel_replace’);
    `

    Is there another way? I don’t want to add the rel attribute to each photo, or at least, I want to add different rel’s depending…
    mmmh, can I use get_post_tags?

  • The topic ‘flexslider(wooslider) with lightbox capabilities’ is closed to new replies.