Disable Auto Format in wordpress

This is a great trick I found today while working on a problem for a client.

What was happening is that wordpress was wrapping her image in paragraph tags and causing it not to float right with text wrapping around it.

The solution was to add this to the functions.php file. (note, make sure you back up your funtions.php file first!)

function my_formatter($content) {
$new_content = '';
$pattern_full = '{(\[raw\].*?\[/raw\])}is';
$pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
$pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);

foreach ($pieces as $piece) {
if (preg_match($pattern_contents, $piece, $matches)) {
$new_content .= $matches[1];
} else {
$new_content .= wptexturize(wpautop($piece));
}
}

return $new_content;
}

remove_filter('the_content', 'wpautop');
remove_filter('the_content', 'wptexturize');

add_filter('the_content', 'my_formatter', 99);

Now you simply add [raw] and [/raw] tags around the element you are having a problem with.

Source

Testing out Twitter Tools

By Dave Fogel | January 21, 2011

This program will auto post your wordpress blog to your twitter account.

Testing out wordbooker

By Dave Fogel | January 21, 2011

Testing the wordbooker plugin.

Getting WordPress to install and work on an IP

By Dave Fogel | January 12, 2011

If you have a reseller account, and you want to work on a live copy of a site, then there are a few keysteps you need to take for it to work. (you could always run it on your HD instead) So let’s say you have a client with a site called www.netviperinteractive.com and you…

Posted in

Dave Fogel

Leave a Comment