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

Where Do Google Ads Appear?

By Dave Fogel | December 14, 2022

Google Ads can appear in a number of different places, depending on the type of ad you’re running and the targeting options you’ve selected. Here are a few places where Google Ads may appear: Search results: When someone searches for a keyword or phrase related to your business, your ad may appear at the top…

How Google Ads Help Small And Medium Sizes Businesses

By Dave Fogel | December 12, 2022

Google Ads is a platform that allows businesses to advertise their products or services through Google’s search engine and other properties, such as Google Maps and YouTube. This platform, formerly known as Google AdWords, is a powerful tool that can help small and medium-sized businesses (SMBs) reach new customers, increase brand awareness, and drive sales.…

Are Google Ads free?

By Dave Fogel | December 10, 2022

No, Google Ads is not free. Google Ads is an advertising platform that businesses use to reach potential customers and increase their online visibility. Google Ads charges businesses for the clicks, impressions, and conversions that are generated by their ads. The cost of the ads depends on the type of campaign and the targeting options…

Posted in

Dave Fogel

Leave a Comment