bennyp

Untitled

Apr 9th, 2012
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 );
Add Comment
Please, Sign In to add comment