Created
September 27, 2017 09:54
-
-
Save ingozoell/73687e7db3c90a7f29543ab6d3ebffb8 to your computer and use it in GitHub Desktop.
// REMOVE P from shortcodes
// https://gist.github.com/bitfade/4555047
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
function the_content_filter($content) { | |
// array of custom shortcodes requiring the fix | |
$block = join("|",array("iz_mehr","iz_col", "text_platzhalter")); | |
// opening tag | |
$rep = preg_replace("/(<p>)?\[($block)(\s[^\]]+)?\](<\/p>|<br \/>)?/","[$2$3]",$content); | |
// closing tag | |
$rep = preg_replace("/(<p>)?\[\/($block)](<\/p>|<br \/>)?/","[/$2]",$rep); | |
return $rep; | |
} | |
add_filter("the_content", "the_content_filter"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment