Revisions
- May 12, 2013 @ 13:42:09 [Current Revision] by PeterLugg
- May 12, 2013 @ 13:39:50 by PeterLugg
Revision Differences
May 12, 2013 @ 13:39:50 | Current Revision | ||
---|---|---|---|
Content | |||
Added: Taken from here: <a href="http:// oikos.org.uk/ 2011/09/tech- notes-using-resized-images- in-wordpress- galleries-and- lightboxes/" target="_blank" >http://oikos.org.uk/2011/ 09/tech-notes- using-resized- images-in-wordpress-galleries- and-lightboxes/</a> | |||
Added: Tell WordPress media gallery image links to open the large version of the image instead of the full size. | |||
Added: [php] | |||
Added: function oikos_get_attachment_ link_filter( $content, $post_id, $size, $permalink ) { | |||
Added: // Only do this if we're getting the file URL | |||
Added: if (! $permalink) { | |||
Added: // This returns an array of (url, width, height) | |||
Added: $image = wp_get_attachment_image_src( $post_id, 'large' ); | |||
Added: $new_content = preg_replace( '/href=\'(.*?)\'/', 'href=\'' . $image[0] . '\'', $content ); | |||
Added: return $new_content; | |||
Added: } else { | |||
Added: return $content; | |||
Added: } | |||
Deleted: | Added: } | ||
Added: add_filter('wp_ get_attachment_link', 'oikos_get_attachment_ link_filter', 10, 4); | |||
Added: [/php] |
Note: Spaces may be added to comparison text to allow better line wrapping.
No comments yet.