Revisions
- November 27, 2012 @ 01:15:22 [Current Revision] by PeterLugg
- November 27, 2012 @ 01:14:55 by PeterLugg
Revision Differences
November 27, 2012 @ 01:14:55 | Current Revision | ||
---|---|---|---|
Content | |||
Added: [php]function oikos_get_attachment_ link_filter( $content, $post_id, $size, $permalink ) { | |||
Deleted: | Added: | ||
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: } | |||
Added: } | |||
Added: | |||
Added: add_filter('wp_ get_attachment_link', 'oikos_get_attachment_ link_filter', 10, 4);[/php] |
Note: Spaces may be added to comparison text to allow better line wrapping.
No comments yet.