root/wp-unformatted/trunk/wp-unformatted.php
| Revision 7568, 1.5 kB (checked in by alexkingorg, 1 year ago) |
|---|
| Line | |
|---|---|
| 1 | <?php |
| 2 | |
| 3 | // WP Unformatted |
| 4 | // version 1.1, 2007-01-24 |
| 5 | // |
| 6 | // Copyright (c) 2004-2007 Alex King |
| 7 | // http://alexking.org/projects/wordpress |
| 8 | // |
| 9 | // This is an add-on for WordPress |
| 10 | // http://wordpress.org/ |
| 11 | // |
| 12 | // ********************************************************************** |
| 13 | // This program is distributed in the hope that it will be useful, but |
| 14 | // WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 16 | // ***************************************************************** |
| 17 | |
| 18 | /* |
| 19 | Plugin Name: WP Unformatted |
| 20 | Plugin URI: http://alexking.org/projects/wordpress |
| 21 | Description: With this enabled, you can add a custom field of 'sponge' set to '1' to a post to disable the auto formatting and a custom field of 'sandpaper' set to '1' to a post to disable the auto smart-quote conversion. |
| 22 | Version: 1.1 |
| 23 | Author: Alex King |
| 24 | Author URI: http://alexking.org |
| 25 | */ |
| 26 | |
| 27 | // conditional auto-p function |
| 28 | function wp_sponge($pee) { |
| 29 | global $post; |
| 30 | if (get_post_meta($post->ID, 'sponge', true) == '1') { |
| 31 | return $pee; |
| 32 | } |
| 33 | else { |
| 34 | return wpautop($pee); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | // conditional texturize function |
| 39 | function wp_sandpaper($text) { |
| 40 | global $post; |
| 41 | if (get_post_meta($post->ID, 'sandpaper', true) == '1') { |
| 42 | return $text; |
| 43 | } |
| 44 | else { |
| 45 | return wptexturize($text); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | // disable auto-p |
| 50 | remove_filter('the_content', 'wpautop'); |
| 51 | |
| 52 | // add conditional auto-p |
| 53 | add_filter('the_content', 'wp_sponge'); |
| 54 | |
| 55 | // disable texturize |
| 56 | remove_filter('the_content', 'wptexturize'); |
| 57 | |
| 58 | // add conditional texturize |
| 59 | add_filter('the_content', 'wp_sandpaper'); |
| 60 | |
| 61 | ?> |
Note: See TracBrowser for help on using the browser.
