// imgを囲んでいるpにstyle='margin:0を追加
function img_p_class_content_filter($content) {
$ptn = "/(<p[^>])(>.)(\<img.*)(<\/p>)/im";
$content = preg_replace($ptn, "\$1 class='post-img'\$2\$3\$4", $content);
return $content;
}
add_filter( 'the_content', 'img_p_class_content_filter' ,20);
https://fragileheart.net/711/
https://the2g.com/209
最近のコメント