Created
May 5, 2014 13:15
-
-
Save PittsburghChris/32dfc5abdb51e0ef7414 to your computer and use it in GitHub Desktop.
Wrap images with figure tag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Wrap images with figure tag. Courtesy of Interconnectit http://interconnectit.com/2175/how-to-remove-p-tags-from-images-in-wordpress/ | |
if( ! function_exists( 'reverie_img_unautop ' ) ) { | |
function reverie_img_unautop($pee) { | |
$pee = preg_replace('/<p>\\s*?(<a .*?><img.*?><\\/a>|<img.*?>)?\\s*<\\/p>/s', '<figure>$1</figure>', $pee); | |
return $pee; | |
} /* end reverie_img_unautop */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment