/** Auto-Generate ALT tag for images */
function image_alt_tag($content)
{global $post;preg_match_all('/<img (.*?)\/>/', $content, $images);
if(!is_null($images)) {foreach($images[1] as $index => $value)
{if(!preg_match('/alt=/', $value)){
$new_img = str_replace('<img', '<img alt="'.get_the_title().'"', $images[0][$index]);
$content = str_replace($images[0][$index], $new_img, $content);}}}
return $content;
}
add_filter('the_content', 'image_alt_tag', 99999);
不怕,改源码而已,出问题了再恢复那个源码就可以了. 能用代码实现的决不用插件
不怕您笑话,我还是不懂要怎么实现,难道add_filter这行代码还要在其他地方调用? 谢谢| 欢迎光临 全球主机交流论坛 (https://fd.vvwvv.eu.org/) | Powered by Discuz! X3.4 |