Adding a hook to a function
-
OK, I need to edit the code that is inserted by the get_image_tag function in the wp-includes/media.php file. I am adding this to the functions.php file in my theme but it’s not working. I could use a little direction here.
function myget_image_tag($id, $alt, $title, $align, $size='medium') { list( $img_src, $width, $height ) = image_downsize($id, $size); $hwstring = image_hwstring($width, $height); $class = 'align' . esc_attr($align) .' size-' . esc_attr($size) . ' wp-image-' . $id; $class = apply_filters('get_image_tag_class', $class, $id, $align, $size); $html = 'testkim<img src="' . esc_attr($img_src) . '" alt="' . esc_attr($alt) . '" title="' . esc_attr($title).'" '.$hwstring.'class="'.$class.'" rel="lightbox"/>'; $html = apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size ); return $html; } add_action ( 'get_image_tag', 'myget_image_tag($id, $alt, $title, $align, $size="medium")' );
The topic ‘Adding a hook to a function’ is closed to new replies.