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

Blocking Spam Bots

By Dave Fogel | May 5, 2015

If you frequently look at your Google analytics and notice you all of a sudden have a huge increase in traffic, you might start getting really excited. The site is finally taking off! Or is it? There is a good chance that bots have started hitting your website. So how can you find out? First…

WordPress Easy Modal and Gravity Forms

By Dave Fogel | February 13, 2015

If you are looking to create a modal box on your site with a gravity form, there is one issue we have run into a few times that can cause you a lot of headaches.  The people at Gravity Forms recommend using Easy Modal for modal boxes with WordPress. In the first instance, we were…

Is your site mobile friendly

By Dave Fogel | February 3, 2015

Making sure your website is mobile friendly is now more important than ever.  But how can you be sure you are mobile friendly? Google has created a testing tool so you can test for yourself.  It is pretty simple to use.  Just type your website into the tool and see what happens. If your mobile…

Posted in

Dave Fogel

Leave a Comment