WordPress.org

Support

Support » Plugins and Hacks » Shortcode to output raw HTML

Shortcode to output raw HTML

  • I’ve been using this great snippet from Jean-Baptiste Jung to output raw HTML with a shortcode. However I’ve realized that this sometimes interferes with the output of other plugins – wpautop and wptexturize are applied wrongly sometimes.

    So I tried re-writing the snippet with the shortcode API. Here’s what I got so far:

    function raw_html($atts, $content = null) {
    	remove_filter('the_content', 'wpautop');
    	remove_filter('the_content', 'wptexturize');
    	return $content;
    }
    add_shortcode('raw', 'raw_html');

    Unfortunately it doesn’t work. Any help would be appreciated. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Here’s one solution as a plugin ML Raw HTML . I’d rather add this to my custom_functions.php file in Thesis theme and avoid adding another plugin though.

    Few other plugins http://wordpress.org/extend/plugins/raw-html/ and

    http://www.wordpress-plugin.org/tag/raw-html/

    Second one inserts short codes by using the shortcodes in raw html mode or via a button in the TinyMCE visual editor toolbar. Going to try these all out and report back.

    Thanks relaxedguy! The ML Raw HTML plugin did the trick. And you’re right, I might just add this to my functions.php file 🙂

    The 2nd one makes use of the snippet I linked to – wpautop and wptexturize are applied wrongly sometimes.

    Turns out ML Raw didn’t work for me. I’m going to hunt down a tinyMCE button for this. All I want to do is be able to add one or more <div class="clear"></div> to posts to keep text flowing around left and right-aligned images correctly. I seem to have some of my footer social buttons creeping up into posts unless I add these divs and I hate pasting in the div in raw html and then publishing from there without seeing in rich-text mode.

    What did you end up with, relaxed? I am looking for something to let me put raw html in parts of pages too. The http://wordpress.org/extend/plugins/raw-html/ one sounds great, but when I add the shortcode to code that’s working fine, it actually breaks the page.

    Anything out there actually work? Just want to protect sections of my page so a client can use the wysiwyg.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Shortcode to output raw HTML’ is closed to new replies.
Skip to toolbar