SHOW:
|
|
- or go back to the newest paste.
| 1 | if( ! function_exists( 'themeblvd_content_formatter' ) ) {
| |
| 2 | function themeblvd_content_formatter( $content ) {
| |
| 3 | $new_content = ''; | |
| 4 | $pattern_full = '{(\[raw\].*?\[/raw\])}is';
| |
| 5 | $pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
| |
| 6 | $pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE); | |
| 7 | foreach ($pieces as $piece) {
| |
| 8 | if (preg_match($pattern_contents, $piece, $matches)) {
| |
| 9 | $new_content .= $matches[1]; | |
| 10 | } else {
| |
| 11 | $new_content .= shortcode_unautop( wptexturize( wpautop( $piece ) ) ); | |
| 12 | } | |
| 13 | } | |
| 14 | return $new_content; | |
| 15 | } | |
| 16 | } | |
| 17 | remove_filter( 'the_content', 'wpautop' ); | |
| 18 | remove_filter( 'the_content', 'wptexturize' ); | |
| 19 | remove_filter( 'the_content', 'shortcode_unautop' ); | |
| 20 | add_filter( 'the_content', 'themeblvd_content_formatter', 9 ); |