• Resolved rsgrone

    (@rsgrone)


    I am using the following to produce an image gallery, and would like to link the original file to the caption. The output on the post is generated by timthumb… any help?

    if ( !empty($attachments) ) :
    	$counter = 0;
    	$photo_output = '';
    	$thumb_output = '';
    	foreach ( $attachments as $att_id => $attachment ) {
    		$counter++;
    
    		# Caption
    		$caption = "";
    		if ($attachment->post_excerpt)
    			$caption = '<p class="sliderCaption">'.$attachment->post_excerpt.''.$caption.' </p>';	
    
    		# Large photo
    		$src = wp_get_attachment_image_src($att_id, $photo_size, true);
    
    			 $photo_output .= '<div><img style="width:'.$photo_width.'px;display:block;" src="' . esc_url($themeurl) . '/timthumb.php?src='.urlencode($src[0]).'&q=90&w='.$photo_width.'&zc=1" width="'.$photo_width.'" alt="" />'.$caption.'</div>';
    		# Thumbnail
    		$src = wp_get_attachment_image_src($att_id, $thumb_size, true);
    
    		$thumb_output .= '';
    	}
    endif; ?>

Viewing 1 replies (of 1 total)
  • Thread Starter rsgrone

    (@rsgrone)

    I added two lines of code to resolve the issue… I declared #img_url and placed the string accordingly

Viewing 1 replies (of 1 total)
  • The topic ‘Adding Link to Image within Post’ is closed to new replies.