I am trying to create a function that will filter the_content depending on image alignment. So far I have this...
function filter_ptags_on_images($content)
{
$content = preg_replace('/<p>\\s*?(<a .*?><img.*?><\\/a>|<img.*?>)?\\s*<\\/p>/s', '$1', $content);
return $content;
}
This is removing the P tag from images but I want to modify it so that it only does this is aligncenter is set on the image.
Does anybody have an example?