$5
How to change the default link_rel value in a image settings?
When I edit an image in the Advanced Settings section, in the Link Rel field, I find the default value: attachment wp-att-9964.
I need to change this default value to: shadowbox[album]. In this way, each time that I edit an image I will find this value by default.
Can you guide me to change this code in the correct php file?
Im using wordpress 3.0.1.
Thanks!
Juan
No Mind | 08/07/10 at 6:08pm
| Edit
(4) Possible Answers Submitted...
-

Last edited:
08/07/10
6:22pm -

Last edited:
08/07/10
6:25pmMike Schinkel says:Seems like "Link Rel" is being added by a plugin? Can you confirm? (What plugins are you using?)
Also, I'm struggling to find the "Advanced Settings" you mention. Can you explain where you are finding them?Previous versions of this answer: 08/07/10 at 6:25pm
- 08/07/10 6:26pm
No Mind says:Im using Shadowbox JS 2.0.4.1
In the 2.9 wordpress version, this value didnt appears like default. - 08/07/10 6:27pm
Mike Schinkel says:Ah, don't have the time to install and research that plugin today. Good luck though.
- 08/07/10 6:28pm
No Mind says:When you insert an image in the post, you click the edit buttom into the image, it opens a popup with 2 labels. One of them is Advanced Settings. Ive include the attachement image with the window.
- 08/07/10 6:26pm
-

Last edited:
08/07/10
7:49pmChris Lee says:You could do it with jquery.
first load jquery in the header.php file
<?php wp_enqueue_script('jquery'); ?>
Method 1: Javascript/jQuery
Add javascript (i'm assuming the attributes: "attachment wp-att-9964" are set with the rel attribute. Or are they classes?
Anyways the following code is for if the attribute values you mentioned are set by a "rel" (ie rel="attachment"
jQuery('document').ready(function () {
jQuery('img[rel="attachment"]').attr('rel','shadowbox[album]'); // set the rel attribute to shadowbox[album]
});
If they're classes then you'd do the following:
jQuery('document').ready(function () {
jQuery('img.attachment"]').addClass('shadowbox[album]'); // set the class to shadowbox[album]
});
i often do this to add lightbox support on images.
Method 2: Add a Filter
Finally Theres the Filter Method.
function my_image_tag_class($class){
$class='shadowbox[album]';
return $class;
}
add_filter('get_image_tag_class','my_image_tag_class');
Previous versions of this answer: 08/07/10 at 7:38pm | 08/07/10 at 7:44pm | 08/07/10 at 7:47pm | 08/07/10 at 7:48pm | 08/07/10 at 7:49pm
-

Last edited:
08/09/10
9:32amDeepak Thomas says:Wordpress does not allow to add/change "rel" attribute to the gallery by default.
You will have to edit post-template.php in the wp-includes directory. Find the following line of code (WP 2.8 has it in line#946)
return apply_filters( 'wp_get_attachment_link', "<a href='$url' title='$post_title'>$link_text</a>",
$id, $size, $permalink, $icon, $text );
Change the above line of code with
return apply_filters( 'wp_get_attachment_link',
"<a href='$url' rel='shadowbox[album]' title='$post_title'>$link_text</a>",
$id, $size, $permalink, $icon, $text );
This question has expired.
Current status of this question: Completed




