Reputation: 71
i'm trying to edit the output of add image in posts the normal code from wordpress is
<a href="http://huemix.ly/wp-content/pics/pic.jpg"><img src="http://huemix.ly/wp-content/pics/pic.jpg" /></a>
i want to replace that output with
<div class="huemix">
<img class="posts-img" src="http://huemix.ly/wp-content/pics/pic.jpg" />
<a href="http://huemix.ly/wp-content/pics/pic.jpg" class="fancybox" ></a>
<div class="fancy"></div>
</div>
all my try goes down :(
Upvotes: 0
Views: 1386
Reputation: 12036
You need to search proper chunk of code in wordpress functions file. The file should be named post.php
and should be located in wp-includes
. The function name should be wp_insert_attachment()
.
Or using filters:
<?php
add_filter( 'image_send_to_editor', 'my_image_func', 10, 7);
function my_image_func($html, $id, $alt, $title, $align, $url, $size ) {
$url = wp_get_attachment_url($id); // Grab the current image URL
$html = "<img src="$url" class="uhuhu"/>";
return $html;
}
?>
Upvotes: 2