I've seen the tutorials on creating a (raw) shortcode that leaves the code inside it untouched,
http://www.wprecipes.com/disable-wordpress-automatic-formatting-on-posts-using-a-shortcode
but unfortunately this only applies to one shortcode at a time... and because the else
statement bypasses the normal filters and calls the functions directions. My other modifications to autop and texturize functions get ignored.
Is there a way to 1. match multiple shortcodes and 2. preserve my other add/remove filters to the_content?
Method 1. First, you'll need to paste the following code to your theme's functions. php file or a site-specific plugin. remove_filter( 'the_content' , 'wpautop' ); remove_filter( 'the_content' , 'wptexturize' );
Easy: go to Appearance > Widgets, place a WordPress Popular Posts widget on any of your sidebars, then save. Next, select the theme you want to use, save again and you'll see the exact HTML config you need to replicate the theme with your shortcode.
After implementing @helgatheviking's solution on multiple websites, I'm convinced that only these lines are required:
// Move wpautop filter to AFTER shortcode is processed remove_filter('the_content', 'wpautop'); add_filter('the_content', 'wpautop', 99); add_filter('the_content', 'shortcode_unautop', 100);
Put them in your functions.php
file and you're set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With