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

Quick WP Menu Tip

By Dave Fogel | January 10, 2011

If you do not want the Parent Menu items clickable, create a custom menu item and link it to “#” (no quotes). Then put your other menu items under that one.

Creating sidebar widgets for Menus in WP 3.0

By Dave Fogel | January 10, 2011

Creating Side Bar widgets for Menus in WordPress 3.0 So you want to add sidebars to your website and do them dynamically. I am sure there are many ways to do this, but here is how I do it. You need FTP access to your wordpress site to do this. I use Dreamweaver to edit…

Upgraded to WordPress 3.0

By Dave Fogel | June 18, 2010

We have just upgraded the site to WordPress 3.0. If you see anything broken, rest assured we are working on fixing it. We look forward to all wordpress 3.0 has to offer the community and your websites.

Posted in

Dave Fogel

Leave a Comment