Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Last active July 4, 2016 05:15
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save strangerstudios/5556801 to your computer and use it in GitHub Desktop.
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.
/*
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