$8
Make images link to medium or large size — not full
How do I make images that are inserted into a post link to the medium or large version, and not the full size?
I see two possible solutions — but I'm not clever enough to hack together a plugin.
1) Create a new button under Link URL in the Media/Gallery section that says "Large Size"
2) Filter the function that outputs images in posts to show the medium/large version instead of the full size
Other suggestions and solutions are of course just as welcome.
Thanks!
Hein Tore Tønnesen | 06/24/10 at 4:37pm
| Edit
(3) Possible Answers Submitted...
-
Last edited:
06/24/10
6:02pmOleg Butuzov says:insert this code to functions.php of your theme.
add_filter('attachment_fields_to_edit', 'medium_attachment_fields_to_edit', 0, 2);
function medium_attachment_fields_to_edit($fields, $post){
if (substr($post->post_mime_type,0,5) == 'image'){
$fields['url']['html'] = str_replace("<button type='button' class='button urlfile'", "<button type='button' class='button urlfile' title='".esc_attr(array_shift( wp_get_attachment_image_src($post->ID, 'medium', false) ))."'>Medium File URL</button>\n<button type='button' class='button urlfile'", $fields['url']['html']);
}
return $fields;
}
added screnshotPrevious versions of this answer: 06/24/10 at 4:58pm | 06/24/10 at 5:02pm | 06/24/10 at 5:14pm | 06/24/10 at 5:14pm | 06/24/10 at 5:22pm
- 06/24/10 5:15pm
Oleg Butuzov says:tested on wp 3.0
- 06/24/10 5:15pm
-

Last edited:
06/24/10
4:44pmRashad Aliyev says:You can made it via CSS file. Look at HTML codes and find your links CLASS, for example: <a href="www.evlenirik.biz" class="largelink">My site</a>
Our class is largelink, find it at your CSS and replase how you want.
If you need more help please contact with me. -

Last edited:
06/24/10
4:46pmChris Lee says:Not sure what your use is for this but you could just insert a post thumbnail for the post:
http://wpengineer.com/the-ultimative-guide-for-the_post_thumbnail-in-wordpress-2-9/
The issue is if you need this to change from large to medium to small size this may be difficult.
Often times i have wordpress spit out both images and have jquery hide one or the other thumbnail based on the template. This could also allow you to (further down the line) to build something more complicated.
Does that help?
This question has expired.
Current status of this question: Completed




