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

Which Google Ads campaign should i use for my Business?

By Dave Fogel | December 18, 2022

Many people associate Google Search Ads, but there are several different types of Google Ads campaigns that you can use for your business, and the best option for you will depend on your specific goals and target audience. Here are a few options to consider: Search ads: Search ads appear in the search results when…

Are Google Ads worth it for small business?

By Dave Fogel | December 17, 2022

Yes, Google Ads can be a great option for small businesses. Google Ads allows businesses to reach their target audiences and engage with potential customers, increasing their online visibility. Additionally, Google Ads can be tailored to the specific needs of small businesses, allowing them to target the right people and optimize their campaigns accordingly. Google…

Are Google Display Ads as effective as Google Search Ads?

By Dave Fogel | December 16, 2022

Google display ads and Google search ads can both be effective at reaching potential customers and achieving your marketing goals, but they work in different ways and may be more effective in certain situations. Here are some key differences between Google display ads and Google search ads: Placement: Google search ads appear in the search…

Posted in

Dave Fogel

Leave a Comment