Last active
July 4, 2016 05:15
-
-
Save strangerstudios/5556801 to your computer and use it in GitHub Desktop.
Replace backticks in WordPress posts, topics, replies, etc with <pre lang="PHP"></pre> so WP-Syntax will highlight it.
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
/* | |
Switch `` with <pre lang="PHP"></pre> | |
*/ | |
function pmpro_code_wrap($content) | |
{ | |
$content = preg_replace("/`(.*?)`/s", '<pre lang="PHP">$1</pre>', $content); | |
return $content; | |
} | |
add_filter("the_content", "pmpro_code_wrap", -1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment