Help get image link title in this function
-
I’m using the below function (found here) so the gallery links to large size images instead of full size ones. The problem is that it removes the title in the large image link (it’s still there in the gallery thumbnail). Does anyone know how I can get it back in the link?
function oikos_get_attachment_link_filter( $content, $post_id, $size, $permalink ) { // Only do this if we're getting the file URL if (! $permalink) { // This returns an array of (url, width, height) $image = wp_get_attachment_image_src( $post_id, 'large' ); $new_content = preg_replace('/href=\'(.*)\'/', 'href=\'' . $image[0] . '\'', $content ); return $new_content; } } add_filter('wp_get_attachment_link', 'oikos_get_attachment_link_filter', 10, 4);
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Help get image link title in this function’ is closed to new replies.