I’m trying to add the caption to the image title tag in wordpress so the lightbox I’m using with display the caption, since all it shows is the title tag. I’ve added $caption as well as many other variations borrowed form the caption shortcode. Any suggestions?
function get_image_tag($id, $alt, $title, $align, $caption, $size='medium') {
list( $img_src, $width, $height ) = image_downsize($id, $size);
$hwstring = image_hwstring($width);
$class = 'align' . esc_attr($align) .' size-' . esc_attr($size) . ' wp-image-' . $id;
$class = apply_filters('get_image_tag_class', $class, $id, $align, $size);
$html = '<img src="' . esc_attr($img_src) . '" alt="' . esc_attr($alt) . '" title=" ' . esc_attr($title).' | '. esc_attr($content).'" '.$hwstring.'class="'.$class.'" />';
$html = apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $caption, $size );
return $html;
}
1 Answer