Gareth, good question here. Please respond to the following.
What’s the current code?
What’s the newly needed code?
Which views are you talking about? Single, list, widget, other.
Hi Michael,
Basically, what I had trying to to do was locate where the featured images for Testimonials (see this page:http://smilestore.ie/testimonials/) were being pulled and manually adding in a lightbox call.
I’m still tinkering and working, but I got as far as locating line 1191 in class-testimonials-widget.php (testimonials-widget-premium/includes/testimonials-widget/includes/libraries/)
Which reads:
$image = '';
if ( $do_image ) {
$pic = $testimonial['testimonial_image'];
$image .= '<span class="image">';
$image .= $pic;
$image .= '</span>';
}
Basically, I was experimenting with trying to call shadowbox through href after the span. First I tried defining the $image to replicate it’s source: $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); and then calling it by echoing it in the href. Sorry if this is making absolutely no sense, I’m only just starting out with php. See below for an exact replica of what I had going.
$image = '';
if ( $do_image ) {
$pic = $testimonial['testimonial_image'];
$image .= '<span class="image"><a href="<?php echo $image; ?>" rel="shadowbox">';
$image .= $pic;
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
$image .= '</span></a>';
}
The issue, I realise is that I can’t seem to locate and add the relevant src path for the images. Any help would be appreciated, and sorry for butchering your code.
Okay, so you want to add rel="shadowbox" to the image’s span class.
At the bottom of that code function you’re working with, there’s an API filter mentioned. Why not use a preg_replace on the $image and then rebuild the outputted HTML?
See the API examples. Also, try the knowledge base for layout changes.