Shortcode to output raw HTML (6 posts)

  1. blogjunkie
    Posted 4 years ago #

    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!

  2. relaxedguy
    Posted 4 years ago #

    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.

  3. relaxedguy
    Posted 4 years ago #

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


    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.

  4. blogjunkie
    Posted 4 years ago #

    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.

  5. relaxedguy
    Posted 4 years ago #

    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.

  6. jivyb
    Posted 4 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic