Created
October 15, 2014 18:02
-
-
Save sidharrell/71f01924d56d460c11a4 to your computer and use it in GitHub Desktop.
replace comma tags in answers in visible (but not hidden) text
This file contains 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
add_filter ( 'the_content', 'who_cares_about_an_oxford_comma', 11 ); | |
function who_cares_about_an_oxford_comma ( $content ) { | |
$base = '#(<span.*)\{comma}(.*</span>)#'; | |
$replace = '$1,$2'; | |
$new_content = ""; | |
while (($new_content = preg_replace( $base, $replace, $content )) != $content) { | |
$content = $new_content; | |
} | |
return $new_content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment