thanks!
-
thanks for this handy little plugin!
i’ve takent the liberty to add another few lines of code, so that it also auto-fills the alt-tag if empty:function lcb_restore_image_title( $html, $id ) { $attachment = get_post($id); if (strpos($html, "title=")) { $returnvar = $html; } else { $mytitle = esc_attr($attachment->post_title); $returnvar = str_replace('<img', '<img title="' . $mytitle . '" ' , $html); } if (strpos($returnvar, "alt=\"\"")) { $mytitle = esc_attr($attachment->post_title); $returnvar = str_replace("alt=\"\"", "alt=\"" . $mytitle . "\"" , $returnvar); } return $returnvar; }
feel free to include this in your plugin, if you think other people will like it.
- The topic ‘thanks!’ is closed to new replies.