Wordpress 为每个图像添加onclick添加到帖子或页面

Wordpress 为每个图像添加onclick添加到帖子或页面,wordpress,media,Wordpress,Media,我想自动添加 class="highslide" onclick="return hs.expand(this,config1)" 我添加到帖子或页面中的每个图像 <a class="highslide" onclick="return hs.expand(this,config1)" href="http://mysite.net/wp-content/uploads/2013/11/image.jpg" target="_blank"><img class="align

我想自动添加

class="highslide"  onclick="return hs.expand(this,config1)"
我添加到帖子或页面中的每个图像

<a class="highslide" onclick="return hs.expand(this,config1)" href="http://mysite.net/wp-content/uploads/2013/11/image.jpg" target="_blank"><img class="alignleft  wp-image-659" alt="" src="mysite.net/wp-content/uploads/2013/11/image.jpg" width="108" height="68" /></a>

我已经寻找了hrs,但没有发现任何可以做到这一点的东西,有人知道可以做到这一点的插件或代码片段吗


谢谢

我为你制作了一个小剪子

/**
 * Function customizes a HTML code to be inserted when inserting a media file through "Add media"     button
 * @param string $insert an original HTML code to be modified
 * @return string
 */
function custom_edit_media_insert($insert)
{
    //check, whether you are inserting an image wrapped in anchor
    if(preg_match('/^(<a).*(<img).*(<\/a>$)/', $insert))
        $insert = str_replace('<a', '<a class="highslide" onclick="return hs.expand(this,config1)"', $insert);

        return $insert;
}
add_filter('media_send_to_editor', 'custom_edit_media_insert');

伊凡,那太棒了!,我不明白你对
所说的是什么,使用外部javascript来达到这样的目的。
我不是有意让你困惑的。我在编辑中提供了更多信息。顺便说一句,这两种方法都是正确的。Ivan,我如何应用java脚本版本,我想你已经解释过了,但我不太明白。谢谢,如果没有jQuery,您会怎么做?
$('.parent a').click(function(){
    return hs.expand($(this),config1);
});