Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2013
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. /*
  4. Add this to the end of your Functions PHP
  5. */
  6.  
  7. /** Disable WP autop using shortcode for selected text, courtesy of Matt Valvano, http://ideasandpixels.com/disable-wordpress-auto-formatting-short-code */
  8.  
  9. function my_formatter($content) {
  10. $new_content = '';
  11. $pattern_full = '{(\[raw\].*?\[/raw\])}is';
  12. $pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
  13. $pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);
  14.  
  15. foreach ($pieces as $piece) {
  16. if (preg_match($pattern_contents, $piece, $matches)) {
  17. $new_content .= $matches[1];
  18. } else {
  19. $new_content .= wptexturize(wpautop($piece));
  20. }
  21. }
  22. return $new_content;
  23. }
  24.  
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement